Search This Blog

Tuesday, May 15, 2012

mySQL dump - Import/Export database

How to import sql dump file to mySQL database?

Connect to the server ssh and run following commands.
Import DB:

cd ~
mysql -u database_user -p yourdatabase_db < restore_db.sql
type your mysql password.
Check if all tables exist:
mysql -u database_user -p
type your mysql password again.
show databases;
connect yourdatabase_db
show tables;
Check if all tables exist.

Export DB:
cd ~
mysqldump -u database_user  -p yourdatabase_db > filename.sql
type your mysql password.
ls -l
check if filename.sql exist.




No comments:

Post a Comment