deep analysis of backup and restore of MySQL database under Linux
1. Backup
[Root@localhost ~]# cd/var/lib/mysql (access to MySQL library directory, adjust directory according to your MySQL installation situation)
[Root@localhost mysql]# mysqldump-u root-p voice>voice.sql, enter the password.
2. Restore
Law I:
[Root@localhost ~]# mysql-u root-p carriage return, enter password, enter MySQL console "mysql>", restore with 1.2.
Law II:
[Root@localhost ~]# cd/var/lib/mysql (access to MySQL library directory, adjust directory according to your MySQL installation situation)
[Root@localhost mysql]# mysql-u root-p voice<voice.sql, enter the password.
Mysqldump:got error:1016 when using LOCK TABLES
Hitidea is a database with a lot of data tables (Wordpress MU), search for a while, and found that as long as the mysqldump when adding –lock-tables=false can solve the problem.
mysqldump-uroot-p123456 Sq_mvclub--lock-tables=false >/home/bak/35.sql