Change website

From Jan 16 2015,


All post content will be move to we's offical website with many content...

Can access website here: http://justox.com

Thanks for your visit!

Friday 27 December 2013

Cpanel Database Backup

The database would be stored in MySQL's base directory, which by default is /var/lib/mysql. If a different base directory is used, it would be specified in /etc/my.cnf.

not recommend simply copying the database files. While this can often work, the approved MySQL method is to create a dump, and use the dump to import the database on the "new" server. The basic syntax is the following on the "old" server:



Code:
# mysqldump yourdbname > yourdbname.sql
This assumes that the MySQL root password is the same as the server's root password. If it is not, specify the root user and the option to enter a password:

Code:
# mysqldump -uroot -p yourdbname > yourdbname.sql
It is the same command, but you will be prompted for the MySQL root password.

This will create a plain text file called yourdbname.sql that contains all of the MySQL statements needed to create the database again in exactly the same state. Copy the file to the "new" server, create the database, and import it:

Code:
# mysql
mysql> create database yourdbname;
mysql> exit
# mysql yourdbname < yourdbname.sql
Note the direction of the greater-than and less-than symbols. Greater-than (>) redirects output to a file, and less-than (<) instructs a command to take its input from a file.

More about the mysqldump command is available in the MySQL documentation:

MySQL :: MySQL 5.1 Reference Manual :: 4.5.4 mysqldump รข€” A Database Backup Program

No comments:

Post a Comment