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
Code:
# mysqldump -uroot -p yourdbname > yourdbname.sql
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
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