[英]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.