为了备份虚拟主机的MySQL数据库,只能用mysqldump导出到本地。

运行:

mysqldump –opt -h192. 168.0 . 156 -uUsername -pPassword databaseName>database.sql

mysqldump –opt -h192.168.0.156 -uUsername -pPassword databaseName>database.sql

但由于数据库用户的权限不够,总显示:
mysqldump: Got error: 1044 : Access denied for user ‘Username’ @ ‘%’ to database ‘databaseName’ when using LOCK TABLES

mysqldump: Got error: 1044: Access denied for user ‘Username’@’%’ to database ‘databaseName’ when using LOCK TABLES
是没有LOCK TABLES的权限,于是查看mysqldump的帮助,加上参数–skip-lock-tables
mysqldump –opt -h192. 168.0 . 156 -uUsername -pPassword –skip-lock-tables databaseName>database.sql

远程导出:

mysqldump -P [端口] -h [IP] -u [用户] -p test>d:/test.sql

例如:

mysqldump -P 3306 -h 192.168.1.224 -u root -p test>d:/test.sql
远程导入:

mysql -h[IP] -P[端口] -u[用户] -p test<c:/test.sql

例如:

mysql -h 192.168.1.224 -P 3306 -u root -p test<c:/test.sql

Comments are closed.

Post Navigation