简体   繁体   English

为什么在尝试使用命令行进入mysql时出现“权限被拒绝”的提示?

[英]Why do I get “Permission Denied” when trying to get onto mysql using command line?

When i go in C:/Program Files/MySQL/MySQL Server 8.0/bin in my command prompt and enter the command >mysql -u root -p, it says 当我在命令提示符下进入C:/ Program Files / MySQL / MySQL Server 8.0 / bin并输入命令> mysql -u root -p时,它说

 $ >mysql -u root -p
bash: mysql: Permission denied

But when I use the MySQL 8.0 Command Line Client, it just asks my for my password and I'm able to use some commands in there. 但是,当我使用MySQL 8.0命令行客户端时,它只要求我输入密码即可在其中使用一些命令。 Why can I use my regular command line? 为什么我可以使用常规命令行? I used windows CMD and git bash and both give me this error. 我使用了Windows CMD和git bash,都给了我这个错误。 I've already set up a password, but it somehow doesn't let me run that one command. 我已经设置了密码,但是以某种方式不允许我运行该命令。

If you are typing the > in front of mysql and you are in the folder C:/Program Files/MySQL/MySQL Server 8.0/bin then you will get this error because you won't have permission to create a file called mysql . 如果您在mysql前面键入> ,并且位于文件夹C:/Program Files/MySQL/MySQL Server 8.0/bin ,则会出现此错误,因为您无权创建名为mysql的文件。 The > character is used to re-direct standard output into a file. >字符用于将标准输出重定向到文件中。 If you don't put an absolute or relative path in, then it assumes the current folder. 如果不输入绝对路径或相对路径,则它将使用当前文件夹。 You are effectively trying to create a file called mysql in that folder. 您实际上正在尝试在该文件夹中创建一个名为mysql的文件。 Try typing ./mysql -u root -p instead. 尝试改为输入./mysql -u root -p

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当mysql命令行工作时,为什么PHP PDO会收到“SQLSTATE [42000] [1044]用户拒绝访问”? - Why does PHP PDO get “SQLSTATE[42000] [1044] Access denied for user” when mysql command line works? 尝试使用mysqldump命令时为什么会出现此错误? - Why do I get this error when trying to use mysqldump command? 使用 MySQL NDB Cluster,访问从节点时出现权限被拒绝的错误 - Using MySQL NDB Cluster, I get a permission denied error when accessing slave nodes 当我通过Nginx使用mysql_connet但命令行正常运行时,权限被拒绝 - Permission denied when I use mysql_connet through nginx but command line runs normally 为什么在MySQL中使用CAST时会出现语法错误? - Why do I get a syntax error when using CAST in MySQL? 当我尝试创建MySQL数据库时,为什么我的权限被拒绝? - Why is my permission denied when I try to create a MySQL database? 无法找到 mySQL -- 尝试从命令行访问 mySQL 时出现“未找到命令”错误 - Cannot find mySQL -- get "command not found" error when trying to access mySQL from command line 当我尝试在命令行中访问 Mysql 时,我在命令行中收到错误消息 - I get an error message in the command line when I try to access Mysql in the command line 从代码中的命令行输入 mysql 后,试图将 Mysql 命令行返回到 bash? - trying to get Mysql command line back to bash after entering mysql from command line within code? Azure-尝试连接到外部MySQL数据库时权限被拒绝 - Azure - permission denied when trying to connect to external MySQL database
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM