Web Hosting Talk







View Full Version : MySql database recover


mithilesh
10-05-2001, 03:45 PM
How can I transfer the mysql database from one server to another server.

ffeingol
10-05-2001, 04:00 PM
Well assuming you have shell access it's real easy

On the "old" server:

mysqldump -u USER-NAME -p DATABASE-NAME > BACKUP_FILE

The FTP BACKUP_FILe to the new server,

On the "new" server:

mysql -u USER-NAMe -p DATABASE-NAME < BACKUP_FILE

Where:

USER-NAME is your MySQL user
DATABASE-NAME is your MySQL database name
BACKUP_FILE is a file name for the backup.

Frank

eva2000
10-05-2001, 04:08 PM
if you have telnet and root access to both servers all you need to do is log in as root user, make sure no one accesses or writes to the database, dump the database, tar and gzip it up, telnet ftp into the other server, then log into the other server via telnet as root user, untar and unzip and then re-import into a new database

server1
# su-
enter your root password
# mysqldump --opt -u root -p databasename > /path/to/backup.sql
# cd /path/to/backup.sql
# tar -cvf - backup.sql | gzip -c > backup.tar.gz
# ftp server2address
type
# bin
change to directory where you want to put the file
# cd /path/to/newlocation
# put backup.tar.gz

in server2
create new mysql database named newdatabase
# su -
enter your root password
# cd /path/to/newlocation
untar and unzip file
# gunzip -c backup.tar.gz | tar -xvf -
import backup.sql into newdatabase
# mysql -u root -p newdatabase < /path/to/newlocation/backup.sql

finished :)

mithilesh
10-05-2001, 05:12 PM
If I haven't telnet access or shell access having permisson for only ftp access.Within this limit how can I solve this problem.

allera
10-05-2001, 05:34 PM
Have your webhost do it for you.

ffeingol
10-05-2001, 05:57 PM
Or you could install phpMyAdmin (assuming php is on the server) and use php to dump/load the db. This is not a very clean way though.

Frank

Palm
10-05-2001, 07:45 PM
Originally posted by allera
Have your webhost do it for you.

He works or is a host.

allera
10-05-2001, 07:59 PM
Originally posted by Palm
He works or is a host.
Oh! :D No wonder someone suggested to use root. Hehe...