MySQL:语法错误:意外的标识符
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/50645402/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
MySQL: SyntaxError: Unexpected identifier
提问by Slaknation
I just installed MySQL on my computer and when I try to create a database from the MySQL shell, I get this error:
我刚刚在我的计算机上安装了 MySQL,当我尝试从 MySQL shell 创建一个数据库时,出现此错误:
MySQL JS > CREATE DATABASE databasename;
SyntaxError: Unexpected identifier
Does anyone know why this is happening? Maybe there is a problem with the insallation of MySQL?
有谁知道为什么会这样?可能是MySQL的安装有问题?
回答by Max Carroll
By looking at this thread here, it looks like you might be using the shell in js mode, you might be able to toggle it off by using the switch
通过在此处查看此线程,您可能正在 js 模式下使用 shell,您可以使用 switch 将其关闭
\sql
https://forums.mysql.com/read.php?10,661192,661203#msg-661203
https://forums.mysql.com/read.php?10,661192,661203#msg-661203
回答by Rahul Prasad
You can type:
您可以输入:
Mysql JS> \sql
Mysql SQL> \connect root@localhost
and provide your password.
并提供您的密码。