How to Create a Database for WordPress

This is part two of a 3-part guide to installing WordPress manually. If you want to install a web server on your local machine, view part one. If your web server is ready (on your machine or your hosting provider), it's time to create a new database.

Go to the /phpmyadmin directory in your home directory. If you are using XAMPP this means http://localhost/phpmyadmin. Otherwise type your home-directory address followed by /phpmyadmin.

Access phpMyAdmin interface from the root directory
phpMyAdmin interface

Create a new database

On the left-side menu (under the phpMyAdmin logo), click 'new' to create a new database.

MySQL new database under phpMyAdmin
Click 'new' under databases.

When the below window appears, choose a name for your database (we'll use 'wpdb') and click 'create'.

MySQL new database name in phpMyAdmin
Choose a database name and click create

You will immediately get a notification saying that the database 'wpdb' (or whatever name you chose) has been created, and it will appear in the list of databases under the 'create' button.

MySQL new database appears in list
Your new database has been created.

Create a new user

Click on the new database you just created. 

In new MySQL database click Privileges tab
This is your new database.

Now you need to create a user who will have access to this database and be able to create, read, update and delete (CRUD) its records. In the options panel on the top of your database, choose 'Privileges' and click 'Add user' under 'new':

Click new user under MySQL database Privileges
Create new user under the Privileges panel in your new database.

Now fill the fields as indicated below. Choose a username (we chose 'wpdbuser'), and use 'localhost' as the host. (This step is especially important, as using '%' on localhost can give error during WordPress installation process.)To create a strong password you can simply click on generate, but remember to save the password you generated to a text file or in your personal records. You will need to supply this username and password to WordPress during installation. However, that doesn't mean you should use an easy password! Simply remember to save it somewhere only you have access to it.

Username and password of MySQL database user will be supplied to WordPress
Choose localhost for XAMPP and remember to record your username and password somewhere safe!

Scroll down and you will see that the 'database for users' option is checked to 'Grant all privileges on database “wpdb”'. This is what you want, so just scroll to the bottom of the page and click 'Go' on the right corner.

Create new database user with all privileges for WordPress
Click 'go' to create the user.

On clicking go you should see the following notification:


This means that you have successfully created a MySQL database and a user who has all privileges on the database. You are now ready to install WordPress 4.0+ on the server.


Post Comment

Tags allowed: <a>,<strong>, <blockquote>.