Backup and restore MySQL tables/database

15 March 2010 | HowTo | Tags: , , , ,

If you have a lagre database that you will take backup on you might find it hard to do so with example phpmyadmin. MySQL made commando for this so you easy can do this in your terminal on both Windows and Linux. I will first go with Linux. OBS: The commando are the same for both Linux and Windows.

MySQLdump commando

mysqldump -u username -ppassword database_name table_name > /your/way/to/sql/file/file_name.sql

SQL for restore table/database

mysql -u username -ppassword database_name < /your/way/to/sql/file/file_name.sql

If you want to backup full database just dont write the table name on first commando.

If you use Windows you have to go to you bin folder who is in your mysql folder. For example in EasyPHP the way is:

c:\program\easyphp-folder\mysql\bin

From there run the commando. Also if you did not understand, you first run the location in simple CMD and then run the commando.


2 Responses to “Backup and restore MySQL tables/database”

Leave a Reply