自学内容网 自学内容网

mysqldump备份数据库提示ERROR 1064 (42000): You have an error in your SQL syntax

在dos下备份数据库的时候提示上面的错误信息

1 错误详情

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'mysql
 -v' at line 1
  • 错误示例图

在这里插入图片描述

2 解决办法

通过查资料知道,不需要登录mysql,只需要在命令行下切换到mysql\bin目录,使用备份命令mysqldump即可
d:\phpStudy\MySQL\bin>mysqldump -uroot -proot testphp >d:\testphp.sql

d:\phpStudy\MySQL\bin>
  • 备份效果示例
-- 实操示例代码
mysqldump -h localhost -u root -p  -P 3306 news > D:\20244\news_20240330.sql

在这里插入图片描述


原文地址:https://blog.csdn.net/qq_24452475/article/details/137176996

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!