Creating the MySQL Database and a User

Creating the MySQL Database and a User

This depends on the hosting provider, sometimes the database will be set up automatically by the hosting provider and in some cases you may nedd to do it manually.

You can contect your hosting provider to know whether the database need to be created manually or not.

In the case, you nedd to create the database for you manually, follow the below instructions:

Using cPanel Control panel:
If you have a cPanel Control Panel for managing your website which is provided by the hosting provider, you can follow the below steps to cretae the database and database user for wordpress:
1.    Log in to the cPanel interface.
2.    Click on the “MySQL Database Wizard” option under “Databases” section.
3.    Click on “Create a Database”
4.   Enter the database name and click Next Step.
4.    After creating the database you nedd to create a user fo it, Click on “Create Database Users”.
5.   Enter the database user name and the password. Make sure that you are using a strong password.
6.   Click “Create User”.
5.    In “Add User to Database” click the All Privileges checkbox and click Next Step.
6.    Note the database name and the user.
7.   Note down the hostname, username, databasename, and the password. (hostname will usually be localhost.)

Using the phpMyAdmin
You can follow the below instructions to create your WordPress database and username if your web server has phpMyAdmin installed:

(Instructions may differ based on versions).
1.    Create a database for WordPress:Enter the database name in the “Create new database” field.
2.   Click Create.
3.    Click on the Home icon in the upper left so that you will be redirected to the main page.
1.    Click on “Add a new User”.
2.    Choose a username for the WordPress databse and give it in “User name” field. Select Use text field from the dropdown.
3.    Choose a difficult-to-guess password and give it in the Password field. Select “Use text field” from the dropdown.
4.   Re-enter the password in the Re-type field.
4.    Note down the database name, username and password you chose.
5.    Leave all options under Global privileges at their defaults.
6.    Click Go.
3.    Click on the Home icon in the upper left so that you will be redirected to the main page.
4.   Click on the “Check privileges” icon on the user that you have created for the WordPress database.
5.  Select the database for WordPress in the “Database-specific privileges” under the “Add privileges to the following database” dropdown.
6.  Click on “Check All” to select all privileges.
7. Click “Go”.
4.    Note host name listed after “Server:”  at the top of the page that appears. (Usually  localhost.)

Creating Database using a MySQL Client (Shell Access)
See the commanda for creating databse from the shell:
1. Enter into the MySQL prompt:
$ mysql -u adminusername -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5340 to server version: 3.23.54

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

Give the mySQL password in the password field.

  1. Create the MySQL database for wordpress:

mysql> CREATE DATABASE databasename;
Query OK, 1 row affected (0.00 sec)

  1. Give all priveleges to the database user:

mysql> GRANT ALL PRIVILEGES ON databasename.* TO “username”@”hostname”
-> IDENTIFIED BY “password”;
Query OK, 0 rows affected (0.00 sec)

Usually hostname is “localhost”. Confirm this with your server admin.

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)

  1. Exit from MySQL:

mysql> EXIT
Bye
$
5. Remember the databasename, username, hostname, and password.

Using the DirectAdmin Interface:
1.. Go to “MySQL Management”.
2.  Click on  “Create new database.”.
3. Give the required details.
4. Click on. “Create.”
5. The next page will show the database, username, password and hostname. Note them for reference.

One thought to “Creating the MySQL Database and a User”

Leave a Reply

Your email address will not be published. Required fields are marked *