如何使用命令提示符连接到 mysql 服务器:错误 [英] how to connect to mysql server using command prompt : error

查看:59
本文介绍了如何使用命令提示符连接到 mysql 服务器:错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下命令使用命令提示符连接到数据库 mysql

I am connecting to database mysql using command prompt using below command

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

我已经做了很多谷歌搜索,但找不到这个问题背后的原因.有什么帮助吗?

I have done a lot of googling but could not find the reason behind this problem. Any help?

推荐答案

您似乎是在 mysql 命令行控制台上执行该语句,但不在系统 shell 提示符下.

It seems you are executing the statement at mysql command line console but not at system shell prompt.

声明

mysql -h localhost -u test -ptest test;

用于系统 shell 提示.

is for system shell prompt.

并且在命令提示符下运行时,您不需要以分号终止命令.
为了在命令行中禁止使用密码,

And while running at command prompt, you don't need to terminate the command by a semi colon.
And for suppressing use of password at command line,

改变

-ptest

-p

然后它会提示您输入密码.

It then prompts you to input your password.

这篇关于如何使用命令提示符连接到 mysql 服务器:错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆