Creating a MySQL database in cPanel is a three step process
- Creating an empty database as well as creating an username and a password
- Linking the user to the database
- Using phpMyAdmin to add tables or update from a SQL backup
Creating the database and user in MySQL:
- Log into your cPanel (like www.yourdomainname.com/cpanel)
- Click on MySQL Database icon on the cPanel home page
- In Create New Database, enter the database name and click the Create Database button. Once created, click on back link to return to the MySQL Database page
- Go to MySQL Users in the same page and enter a username. Click on Generate Password to create a password for the username. Finally, click on Create User button. Once created, click on the back link to return to the main MySQL Database page
- Now the database and a user are created. Now we have to link both of them. So go to Add User to Database. Select the user and database that you have created from the drop-down menus. Click on Add button. If you are asked for Privileges, select All Privileges and click on Make Changes button. After getting the confirmation message, click on the back link to go back and go to the cPanel home page
Creating tables and updating data using phpMyAdmin:
- Go to the Databases section in cPanel home page and click on the phpMyAdmin icon
- A new browser window will open with the phpMyAdmin home page. Click on the database from the left frame. This should change the content in the right frame
- In the right frame, you can follow the intuitive forms to create a table
- If you have a SQL backup, click on SQL tab in the right frame
- In the Run SQL Query window, paste the entire content of your SQL backup file and click on the Go button. This should update the database with the tables and data.
Remember to change the values in the database connection script – update the database host, username, password and the database name.
