How to backup/restore your MySQL database

If you run a database driven website, it is important to backup your databases very frequently. You can generate a full back up to do this as well but sometimes it may not be unnecessary to backup everything, just to backup your databases. To just backup the databases please do the following:

1. Click Backups
2. Under Download a MySQL Database Backup click the name of the database for which you wish you would like to back up.
3. Click save as
4. Select a destination for where you would like the back up to locally be saved to.

If you have ever made a boo-boo with a database, you can always restore the database very easy and quick. To restore a database, please do the following:

1. Click Backups
2. Click the Browse button next to the option which says “Restore a MySQL Database”
3. Select the SQL file for which you would like restored.
4. Click the open button and click the upload button

This will now upload the mysql file which you can see in the “MySQL Databases” section in cPanel. You can also make changes to it in PHPMyAdmin.

How to create a MySQL database

If you are using any type of PHP software or keeping a collection of records which need to be accessed in some way, you will need to create a database. Below will show you how to create a MySQL database in cpanel

1. Click MySQL Databases
2. In the box to the right of “New Database:” Please provide a name for the database. Please note cPanel will create the full name of the database as cpaneluser_databasename
3. Click “Create Database” Button

You have now successfully add the database, You will now need to create a user to access the database.

How to create a user for a MySQL Database

When ever you have any type of MySQL database, you will need to assign a user to be able to access the database. If you would like to create a user and give them access to the database, please do the following:

1. Click MySQL Databases
2. Scroll down until you see the Current Users section
5. under this section and to the right of “User name:” ,please provide a user name for a database
6. Please note that that full database user will be “cpaneluser_databaseuser
7. To the right of “Password:” Please type the password for which you would like to create for this database user.
8. Click Create User

You have now created a database user. You now need to give the user privilages for your specified database

1. In the drop down menu to the right of “User:” Please sect the user for which you would like give privileges to.
2. To the right of “Database:” please select a database for which you would like the user to have privileges to.
3. Under privileges please choose what type of privileges you would like the user to have.
4. Click “Add User To Database” Button You have now created a new database with a privileged user. You can now input the information into a php script or another script to access it locally

You have now just gave a user permissions to a database.

How to delete a MySQL Database

If you are deleting a script or would like to restart a new database, the first step is to delete the old MySQL database. To do so, please do the following:
1. Click MySQL Databases
2. Under “Current Databases:” you will find the names of all your current databases.
3. Click Delete next to the name of the database you would like to delete.

You have now deleted a MySQL Database.

note: You may also need to delete the user who is accessing the database as well, if you would like not to have any further traces of the that database lingering.