sql database command backup and restore

MySQL backup and restore are done using mysqldump, mysql and source commands.

1 Backup
Start menu | Run | cmd | Use "cd \Program Files\MySQL\MySQL Server 5.0\bin" to enter the bin folder | Use "mysqldump? -u username -p databasename >exportfilename" to export the database to a file, such as mysqldump -u root -p voice>voice.sql, and then enter the password to start exporting.

2 Restore
Enter the MySQL Command Line Client, enter the password, enter "mysql>", enter the command "show databases;", press Enter, and see what databases are there; create the database you want to restore, enter "create database voice;", Enter; switch to the newly created database, enter "use voice;", enter; import data, enter "source voice.sql;", enter, start importing, "mysql>" appears again and there is no error prompting success.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327074484&siteId=291194637