Back Up and Restore Website | Affordable Web Hosting Plans | Cheap Domain Name Registration

Back Up and Restore Web Site

Restore MySQL Database

How to restore a MySQL Database

You don't need to restore a MySQL Database, unless:

  • You move your old hosting account from other company to MyGreatName.
  • You happen to delete the database in your hosting account.
  • Your hosting account is damaged by accident.
  • Others...

Restore a MySQL Backup will restore the following to your hosting account:

  • Create all tables of the Restore Database
  • Restore the records of the tables.

You must do a MySQL Database backup before you can Restore a MySQL Database Backup. The Restore procedures are very simple.

  1. Login your cPanel account.
  2. Select the Download/Upload backup file.
  3. Select the "Restore a MySQL Database Backup".
  4. Browse the backup file (in .gz format) in your computer.
  5. Click the Upload button
  6. Done!

This may take a few minutes, depend the size of your database. After the restore is finished, you can see the details of the restore as below:

Restore a MySQL Database Backup

Restoring files

--------------
DROP TABLE IF EXISTS mytable
--------------


--------------
CREATE TABLE mytable (
id int(11) NOT NULL auto_increment,
username varchar(10) default NULL,
nick_name varchar(60) default NULL,
PRIMARY KEY (id)
) TYPE=MyISAM
--------------
--------------
INSERT INTO mytable (id, username, nick_name) VALUES (1,'cookie','best girl')
--------------


--------------
INSERT INTO mytable (id, username, nick_name) VALUES (2,'peter','good man')
--------------


.......................................................
.......................................................
.......................................................
.......................................................
--------------
DROP TABLE IF EXISTS myfriend
--------------


--------------
CREATE TABLE myfriend (
username char(12) NOT NULL default '',
email char(40) default NULL,
PRIMARY KEY (username)
) TYPE=MyISAM
--------------


--------------
INSERT INTO myfriend (username, email) VALUES ('haha' ,'haha@xxxxxxxxx.com')
--------------


--------------
INSERT INTO myfriend (username, email) VALUES ('hehe' ,'haha@xxxxxxxxx.com')
--------------
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................

If you have more than one database, restore them one by one.

If you have used scripts (e.g. PERL or PHP) in your website to connect to the database, you need to create user(s) and grant access to the user(s) as well. The Backup and Restore process CANNOT restore this setting.

To create user(s), please follow:

  1. Login your cPanel account.
  2. Click the link of MySQL Databases.
  3. Fill in the username and password under Create MySQL user.
  4. Click the "Create MySQL User" button.
  5. Repeat if you need to create other MySQL users
  6. Done!
To grant access to the user(s), please follow:
  1. Login your cPanel account.
  2. Click the link of MySQL Databases.
  3. Select username and MySQL Database under Grant all permissions on a MySQL database to a MySQL user.
  4. Click the "Grant Permissions" button.
  5. Repeat if you need to grant other MySQL users to use the database
  6. Done!
backup and restore web site