Mysql database backup methods and when using LOCK TABLES error Solution

You can save the following code as backup.bat, it can add a scheduled task.

@echo off
set "yMd=%date:~,4%%date:~5,2%%date:~8,2%"
set "hm=%time:~,2%%time:~3,2%"
"D:/MySQL5.6/bin/mysqldump.exe" -h127.0.0.1 -uname -pxxxx -P3306 --skip-lock-tables dbname>"D:/db_bakup/db_xx_%yMd%-%hm%.sql"
@echo on

 You can also copy directly in the cmd command execution in a single statement, pay attention to modify the path to your own computer.

 Description: - skip-lock-tables

 Can not appear as open file when using LOCK TABLES error, possibly leading to insufficient permissions, here we add the --skip-lock-tables in the above code can solve the problem.

Guess you like

Origin www.cnblogs.com/ymmt/p/11243938.html