A database can store various data for your sites, such as site pages, posts, categories, users. Many CMS are database driven, notably the WordPress, Joomla, Drupal, Magento and so on. MySQL is one of the most popular web database types. A lot of websites are driven by MySQL DB. It is fast, easy to install and manage and best of all, it is open source and free.
Many CMS and website scripts can help you generate MySQL databases automatically in the installing process. For instance, you can follow the steps to automatically install WordPress on HostGator servers using the one-click auto installer provided.
Alternatively you can also choose to manually setup a MySQL database on Apache server. cPanel is the most popular web hosting control panel for Apache servers. All major web hosts support cPanel. You’ll learn how to create MySQL databases in cPanel below. We’ll use Hostgator hosting service in this demo. The same procedure however applies to other cPanel hosting service providers. You may see some differences due to the various cPanel versions, optimized cPanel, cPanel themes. If you’re looking for a host that supports PHP and MySQL, you should try Hostgator, our web host of choice. They provide optimized cPanel that you can use to manage your sites, domains, databases, email, etc.
How to create a MySQL Database in cPanel?
Log in your cPanel, locate the DATABASE section where you can find various database tools, like phpMyAdmin, MySQL Databases, MySQL Database Wizard, Remote MySQL, etc. Here you can choose either MySQL Databases or MySQL Database Wizard to add a new DB in cPanel. In this tutorial we will discuss how to create a new database from MySQL Databases other than the DB Wizard.
Click MySQL Databases and follow these steps to setup a new MySQL DB.
Step 1. Choose a name for your database
Your database may have a prefix in its name. In the Create New Database section, type in the new database name after its prefix, hit Create Database to create a new DB in cPanel.
Step 2. Create a database user
You need to define a user account to access your database in cPanel. Again the user may also have a prefix, usually the same with database. Type in the new DB username, then input the same password twice. Choose a strong password manually or use the Password Generator to create one for you automatically. Make sure to write down your DB credentials or copy them somewhere for records. Click Create User button to proceed when you are ready.
Step 3. Add user to database
As we mentioned above, you need to define a user to access the database. Now add the user to database in cPanel.
Step 4. Grant user permissions to database
The last step is to grant the user permissions required to the MySQL database in cPanel. By default All Privileges will be checked. You can disable any privileges according to your needs. Generally speaking you may need to great the user full access to your database when you are installing a CMS such as WordPress, Magento, Drupal, Joomla. You can manage or change them to the correct privileges in a later time.
Backup & Restore MySQL DB
Now you have setup a brand new database which does not have any content, no tables, no fields. You can go to backup your old database and restore the backup to this new DB. phpMyAdmin is the default database management tool provided in cPanel. You can backup MySQL DB with phpMyAdmin first. Download the database backup file from your previous hosting service to your local computer, then restore it to the new MySQL database also using the phpMyAdmin tool.