Categories
MySQL

MySQL Commands

Export:


mysqldump -u username -p database_name > dump.sql

Import:


mysql -u username -p database_name < dump.sql

Live export/duplication (note you may need to enter the password on the line for the mysql command):


mysql -uuser -ppassword -e 'DROP DATABASE test_db;'
mysql -uuser -ppassword -e 'CREATE DATABASE test_db;'
mysqldump -uuser -ppassword live_db | mysql -uuser -ppassword test_db;

 

Leave a Reply

Your email address will not be published. Required fields are marked *