In-depth analysis of MySQL database backup and restoration in Linux
1. Backup
[Root @ localhost ~] # Cd/var/lib/mysql (go to the MySQL database directory and adjust the directory based on your MySQL installation)
[Root @ localhost mysql] # mysqldump-u root-p voice> voice. SQL. Enter the password.
2. Restore
Method 1:
[Root @ localhost ~] # Mysql-u root-p press enter and enter the password to go To the MySQL console "mysql>", which is restored in the same way as 1.2.
Method 2:
[Root @ localhost ~] # Cd/var/lib/mysql (go to the MySQL database directory and adjust the directory based on your MySQL installation)
[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 many data tables (Wordpress MU). After searching, we found that adding-lock-tables = false to mysqldump can solve the problem.
Mysqldump-uroot-p123456 sq_mvclub -- lock-tables = false>/home/bak/35. SQL