我正在使用以下命令使用命令提示符连接到数据库 mysql
mysql -h localhost -u test -ptest test;
但我收到以下错误:-
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
-h localhost -u test -ptest test' at line 1
我已经做了很多谷歌搜索,但找不到这个问题背后的原因。有帮助吗?
最佳答案
您似乎是在 mysql
命令行控制台而不是在系统 shell 提示符下执行语句。
声明
mysql -h localhost -u test -ptest test;
用于系统shell提示。
并且在命令提示符下运行时,您不需要以分号终止命令。
为了在命令行中禁止使用密码,
改变
-ptest
到
-p
然后它会提示您输入密码。
关于php - 如何使用命令提示符 : error 连接到 mysql 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22761955/