cPanel Tutorial: Creating a MYSQL Database

For using databases with web applications, one of the most popular choices today is MYSQL. MYSQL is an RDBMS (relational database management system) allowing to manage data within the database through command line, front-ends, desktop or web applications. Many popular web applications make use of MYSQL including Joomla, WordPress, phpBB and Drupal etc. Here is a detailed tutorial about how to create a new MYSQL database through cPanel.

cpanel-create-mysql-database

Step 1: Finding MYSQL options in cPanel

Once you have logged into your cPanel account, you can find all the MYSQL options under the section titled “Databases”.

Step 2: Creating a New MYSQL Database

To create a new database, click on the option “MySQL® Databases” in the above figure. On the next page, you can create a new database. You need to enter a name for the database and then click on the button “Create Database”. All the databases are prefixed with your cPanel username and an underscore ( _). This helps to avoid any name conflicts with the databases of other users on the same server.

The next page confirms the creation of database. Click on “Go Back” button to return to the previous menu.

Step 3: Creating a User for MYSQL Database

Once a database is created, a user has to be added to the database for accessing it. For this purpose, you need to fill in username and password. The username will be prefixed again with cPanel username and an underscore ( _) for the same reason as stated above. Once you have filled in username and password, click “Create User” button.

The next screen will confirm the creation of a new user. Click on “Go Back” button to return to the previous menu.

By default you can use your cPanel username and password for accessing any database within that account, however, it is undesirable because of certain reasons. As soon as you change the password of your cPanel account, any script configured with old password of database won’t be able to access the database and you will need to change the password manually in the configuration file of the script. Secondly, since most scripts save database passwords in plain text, writing down your cPanel password inside the script will be a security risk.

Step 4: Adding User to MYSQL Database

Once you have the database available from Step 2 and a user created from Step 3, you need to give this user access to the MYSQL database. To do this, go down to the “Add User to Database” section. Select the user which you want to grant access from the “User” drop-down menu and select the database that can be accessed by this user from “Database” drop-down menu. Once it’s done, click the “Add” button.

On the next page, you can see the privileges you want to grant to this user for a particular database. If you are not sure, it’s better to select “All Privileges”. Then click “Make Changes” button.

That’s it, you have created a new MYSQL database and granted access to a particular user to make changes to the database. Now, you can use the user and its password in any script to allow the script to automatically make changes to your database.

Leave a Reply