giza
06-04-2002, 10:37 AM
I move one website to others server. I have difficult to move MySQL data..who can help me..how to move this?
![]() | View Full Version : Move MySQL data to another server giza 06-04-2002, 10:37 AM I move one website to others server. I have difficult to move MySQL data..who can help me..how to move this? AussieHosts 06-04-2002, 12:12 PM One way, on a plesk box with shell access: cd /usr/local/psa/mysql/bin To backup 1. mysqldump -h localhost -u <dbUsername> -p <database> > <file.sql> 2. cp file.sql /usr/local/psa/home/vhosts/<domain.com>/httpdocs/ Grab the dump, upload to new server and restore with /usr/local/psa/mysql/bin/mysql <database> -u <dbUsername> -p < /usr/local/psa/home/vhosts/<domain.com>/httpdocs/<location_of_sql_dump> Gary jahsh 06-04-2002, 12:14 PM If you have shell access it's pretty easy: mysqldump -u USER-ID -p DATABASE-NAME > DUMP-FILE Where: USER-ID is your mysql user-id DATBASE-NAME is your mysql database DUMP-FILE is the dump (backup) file you want to create This will backup all the table structures as well as create insert statements for all your data. Then ftp DUMP-FILE to the new host. On the new host you run the following: mysql -u USER-ID -p DATABASE-NAME < DUMP-FILE This will reload the data. You can do the same thing with phpMyAdmin. forgot to add this: if you are moving from one server to another then beware of differences in mysqldump versions - you may find that cat is the only way to re-populate the new database cat backup.sql | mysql -u root -p new_database Where backup.sql is the backup file and new_database is obviuosly the name of the new database. |