You are on page 1of 16

SONY S.

WIJAYA
Backup using phpMyAdmin
1. Open phpMyAdmin

2. Select a database or table

3. Click on the Export tab

SONY S. WIJAYA
4. Click Kirim (Go), then the database will be downloaded.

SONY S. WIJAYA
Restore using phpMyAdmin
1. To restore (import) a database via phpMyAdmin, choose the database that will be where
the data imported to.
2. Then, click on the Import tab

3. Choose the file from local computer

SONY S. WIJAYA

4. Then click Kirim (Go) to upload and import the database

SONY S. WIJAYA

5. The database imported/restored successfully

SONY S. WIJAYA
Backup using MySQL Administrator
1. Open MySQL Administrator and fill in the form based on MySQL service server and user
credentials

2. If the log in successful, the serves status will appear

SONY S. WIJAYA

3. To backup a database, click on Backup


button from the left menu. After
that, click New Project to create a backup project. Give a name for the project, then click
Save Project

SONY S. WIJAYA
4. Select which databases that will be backed up. After that, click on the right-pointing
arrow to mark the database for backup. Finally, click on the Execute Backup Now to
start the database backup.

5. Then, choose the location for the backup file. After that, click save. The database
successfully backed up.

SONY S. WIJAYA
Restore using MySQL Administrator
1. Click on the Restore Button
File button.

from the left menu. Next, click the Open Backup

2. Choose the database that will be restored. Then, click Open.

SONY S. WIJAYA
3. After file loaded, choose the target schema. If the database will be backed up in new
schema, choose New Schema and give it a name. If the database will be backed up in
original schema, choose Original Schema. Finally, click Start Restore.

4. If the restore process success, the new schema from backed up database will appear.

SONY S. WIJAYA
Backup using MySQLDump
1. First of all, open Command Prompt and change directory into bin folder of MySQL

2. Backup a single database


a. Type mysqldump -u root p [name of database] > [directory destination and file
name]

b. After that, enter the password


c. If the backup successfully works, the new file of database will appear

3. Backup all databases


a. My databases

b. Type mysqldump -u root p --all-databases > [directory destination and file name]

c. After that, enter the password


d. If the backup successfully works, the new file of database will appear
e. Verify the all_databases.sql dumpfile contains all of the databases backup.
f. Type findstr i Current database: [file name and location]

SONY S. WIJAYA
4. Backup a specific table
a. Choose a database and the table that will be backed up.

b. In CMD, type
mysqldump -u root p [database name] [table name] > [directory destination and
file name]

c. After that, enter the password


d. If the backup successfully works, the new file of database will appear

SONY S. WIJAYA
Restore using MySQLDump
1. First of all, create new database

2. Then, open Command Prompt and change directory into bin folder of MySQL

3. Type mysql -u root -p [database destination name] < [backup file name and location]
4. After that, enter the password

5. Check the new restored database. The database successfully restored.

SONY S. WIJAYA
Backup using MySQL
1.
2.
3.
4.

Open the MySQL Client


Before performing backup, the tables should be locked and flushed.
First, use the database
To lock the table, write mysql query:
LOCK TABLES [table name] WRITE;

5. To flush the tables, write mysql query:


FLUSH TABLES;

6. Backup the result of SQL


a. Write mysql query:
SELECT * FROM [table name] INTO OUTFILE '[filename.txt]';

b. The result will be appearing as a txt file in the database folder. If the .txt file opened,
the records will appear in one line.

SONY S. WIJAYA
c. To export the students table in CSV format with CRLF-terminated lines, write mysql
query:
SELECT * FROM [table name] INTO OUTFILE '[filename.txt]'
FIELDS TERMINATED BY ',' ENCLOSED BY '"'
LINES TERMINATED BY '\r\n';

d. CSV format gives better appearance

7. Backup database table


a. Write mysql query:
BACKUP TABLE [table name] TO [folder location];
NOTE
This statement is deprecated and is removed in MySQL 5.5.
As an alternative, mysqldump or mysqlhotcopy can be used instead.
(https://dev.mysql.com/doc/refman/5.0/en/backup-table.html)

SONY S. WIJAYA
Restore using MySQL
1. Open the MySQL Client
2. First, use the database

3. Write mysql query:


LOAD DATA INFILE [file name] INTO TABLE [table name destination];

4. The records will be added into students table

You might also like