我用的是windows机器。一切都已成功安装。当我试图在我的MySql外壳中编写mysql-js> mysql -u root -p时,它显示了unexpected identifier错误。要连接到mysql服务器,我应该写什么?
发布于 2018-02-14 19:41:45
只需检查您处于哪种模式。进入sql模式
mysql-js> \sql要连接:
mysql-js> \connect root@localhost并输入密码
发布于 2019-03-12 18:19:09
发布于 2017-07-11 14:27:29
看起来您正在尝试从mysql客户端外壳中运行mysql程序。这是错误的。您只能在command.exe提示符下运行mysql。
C:\> mysql -u root -p
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 72
Server version: 8.0.1-dmr MySQL Community Server (GPL)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>此时,您处于mysql shell中,该shell是从Windows命令shell运行的。您不能在mysql shell中运行程序,但您不必这样做。
这里记录了这一点:https://dev.mysql.com/doc/refman/5.7/en/mysql.html
一旦进入mysql shell,就可以使用connect命令连接到新服务器。但这样做并不常见。当您调用mysql shell时,连接就足够了。
mysql> connect mydatabase 127.0.0.1用于此连接的用户名和密码是您在第一次调用mysql shell时指定的用户名和密码。
这里记录了这一点:https://dev.mysql.com/doc/refman/5.7/en/mysql-commands.html
https://stackoverflow.com/questions/44481917
复制相似问题