gpt4 book ai didi

php - 如何使用命令提示符 : error 连接到 mysql 服务器

转载 作者:可可西里 更新时间:2023-11-01 07:49:42 25 4
gpt4 key购买 nike

我正在使用以下命令使用命令提示符连接到数据库 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com