Setup MySQL Databases
From Lunarpages Web Hosting Wiki(Redirected from Create MySQL Databases in Cpanel)
Many of the scripts and services you wish to install and get running use MySQL databases to store the information on the web site. The information is then pulled from the databases, at the request of the script and then displayed to your readers. Here we will help explain how to setup a MySQL database in cPanel.
Create Database and User with the MySQL Database Wizard
After logging into your cPanel, scroll down to the Databases section and click on the MySQL Database Wizard link.
Type in the name for your database and then click Next Step. Please note, there is a limit of 8 characters that you can enter for the database name.
Enter a username to be associated with the database, then enter the password twice. Below the password boxes is a bar that indicates the strength of your password. Choosing a strong password is particularly important in web hosting. Web servers are usually more powerful and have access to greater bandwidth than your personal computer; this makes them a prime target for password crackers. We strongly recommend using the built-in password generator to create your password.
Click the Create User to continue.
On the next screen click the box next to All Privileges to enable all of the privileges for this user, or you can manually select them. Click on the Next Step button and cPanel will create the database and assign the user to it.
Manually Setup MySQL Databases in cPanel
First thing to start with would be to login to cPanel. Once you are in, scroll down the front page until you reach the icon that reads, "MySQL® Databases". Click it to be taken to the MySQL Database Management web page.
Create a MySQL Database
The first thing to do is create a name for the new database. Under "Current Databases" you should see an empty text box like this one:
Type the name you wish to use for your database here. Make sure you make note of the name you used, and then hit the "Create Database" button.
Create a MySQL Database User
Now if you scroll down to about half way on the MySQL Database Management web page, you see a section titled, "Current Users". Under this text, you should see two empty text boxes. One box is for your database's user name and the other is for your user name's password. These should be unique to this database and should not be your account user name and password.
Also, make the password 6-8 alpha-numeric characters, and it should not contain the user name. Make note of both the user name and password you used, and then hit the "Create User" button.
Granting User Access to a MySQL Database
The last step would be to add the user you have created for the MySQL database to the database itself. You should see where to do this under "Add Users To Your Databases".
Ensure that you have the correct user name and database name selected from the drop down menus. For "Privileges" make sure only the "All" check mark box is selected. Once you have made your selection in both of the drop down boxes, hit the button named, "Add User to Db". You have now successfully created a new MySQL database.
You can now copy and paste the code below into any files you have the need to contact to the database.
Please Note: If you have any databases that use your cPanel user name and password, you would need to update your configuration files to reference the new password. We recommend to avoid this issue is to create an independent user for your each of your databases. That way the password is constant and not dependent on your cPanel password.
To create a separate user in cPanel, click on the MySQL icon, create user, then assign the user to your database, granting 'dba' access (full privileges).