Database restore through SSH

Status
Not open for further replies.

GoPantheoN

Active Member
908
2009
19
0
i am a noob in ssh so guys tell me frm first step to last in restoring a database thro ssh in cpanel

edit : ssh is enabled in that cpanel
 
6 comments
You will need the database username, password and database name, and putty
After you ssh into OLD server, type "mysqldump -u USER_NAME -p DB_NAME | gzip > FILE.sql.gz"
Enter the database password when it asks. Then, usinf FTP or sFTP, copy the FILE.sql.gz file from the OLD server to the NEW server. (Presumably by copying it from OLD server to your PC and then to NEW server.)
After you ssh into NEW server, type "gunzip < FILE.sql.gz | mysql -u USER_NAME -p DB_NAME"
Enter the database password when it asks. When it is done, your database will be copied to the new server.

Restoring . ssh to new host (make sure the database actually exists!)

mysql database -uusername -p < database.sql
or simply mysql database -uusername -p
enter password
source database.sql

PM me if you need more help.
 
in shh type:
mysql -uyour_dbuser -pyour_dbname </home/location/of/database/data.sql
hit enter
it will then ask for password of database enter it and hit enter

you could also do this:
cd /home/location/of/database
mysql -uyour_dbuser -pyour_dbname <data.sql
hit enter
it will then ask for password of database enter it and hit enter
 
You will need the database username, password and database name, and putty
After you ssh into OLD server, type "mysqldump -u USER_NAME -p DB_NAME | gzip > FILE.sql.gz"
Enter the database password when it asks. Then, usinf FTP or sFTP, copy the FILE.sql.gz file from the OLD server to the NEW server. (Presumably by copying it from OLD server to your PC and then to NEW server.)
After you ssh into NEW server, type "gunzip < FILE.sql.gz | mysql -u USER_NAME -p DB_NAME"
Enter the database password when it asks. When it is done, your database will be copied to the new server.

Restoring . ssh to new host (make sure the database actually exists!)

mysql database -uusername -p < database.sql
or simply mysql database -uusername -p
enter password
source database.sql

PM me if you need more help.

Very, very helpful!
Thank you! :)
 
Status
Not open for further replies.
Back
Top