MySQL 如何克服 ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23950722/
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
how to overcome ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO) permanently
提问by user3690599
when am trying to open mysql in windows cmd by typing mysql. the following error is occuring.
当我尝试通过键入 mysql 在 windows cmd 中打开 mysql 时。发生以下错误。
ERROR 1045 (28000): Access denied for user ODBC@localhost (using password: NO)
And then by looking similar queries i somehow got a temporary solution by using
C:> mysql -u root -p
and then typing the password, mysql
is working. But when i close and open, the same problem is recurring.
然后通过查看类似的查询,我通过使用C:> mysql -u root -p
然后输入密码以某种方式得到了一个临时解决方案
,mysql
正在工作。但是当我关闭和打开时,同样的问题再次出现。
One more thing is that i have created a user 'admin'. but when am trying to open mysql using the command C:> mysql --user=admin --password=root
, the following error is occuring:
还有一件事是我创建了一个用户“管理员”。但是当我尝试使用命令打开 mysql 时C:> mysql --user=admin --password=root
,出现以下错误:
C:\Users\abhay kumar>mysql --user=admin --password=root
ERROR 1045 (28000): Access denied for user 'admin'@'localhost' (using password:NO)
Any help will great
任何帮助都会很棒
回答by user3753172
for some reason, the ODBC user is the default username under windows even if you didn't create that user at setup time. simply typing
出于某种原因,即使您没有在设置时创建该用户,ODBC 用户也是 Windows 下的默认用户名。简单地打字
mysql
without specifying a username will attempt to connect with the non-existent ODBC username, and give:
不指定用户名将尝试连接不存在的 ODBC 用户名,并给出:
Error 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO)
错误 1045 (28000):用户 'ODBC'@'localhost' 访问被拒绝(使用密码:NO)
Instead, try specifying a username that you know, for example:
相反,请尝试指定您知道的用户名,例如:
mysql -u root -p
where -u root
specified the username root
and -p
will make the command prompt for a password.
其中-u root
指定了用户名root
,-p
并将使命令提示符输入密码。
回答by Imtiaz
You need to create an user "ODBC" for MySql with no password. Do that in PHPMyAdmin. That will solve your problem.
您需要为没有密码的 MySql 创建一个用户“ODBC”。在 PHPMyAdmin 中执行此操作。那将解决您的问题。
But remember, if it's only your local development environment, no problem. It'll create a serious security hole in your production environment.
但是请记住,如果只是您本地的开发环境,那没问题。它会在您的生产环境中造成严重的安全漏洞。
回答by ravi ranjan
I tried this and it worked:
我试过了,它奏效了:
C:\cd MySQL installed path\MySQL -uyourusername -pyourpassword
回答by Madhu Baswani
C:\Users\abhay kumar>mysql --user=admin --password=root..
This command is working for root user..you can access mysql tool from any where using command prompt..
此命令适用于 root 用户..您可以使用命令提示符从任何地方访问 mysql 工具..
C:\Users\lelaprasad>mysql --user=root --password=root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.5.47 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, 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.
回答by DickoVan
I know it's been three years since this was asked, but I just figured out this problem for myself. I was using into outfile
and getting the error. When I commented out this part of the query, it worked.
我知道自从问这个问题已经三年了,但我只是为自己解决了这个问题。我正在使用into outfile
并收到错误。当我注释掉查询的这一部分时,它起作用了。
The FILE
privilege is separate from all the others and must be granted to the user running the script.
该FILE
权限与所有其他权限分开,必须授予运行脚本的用户。
GRANT FILE ON *.* TO 'asdfsdf'@'localhost';
回答by Rider
If you are using dj-database-url check the schema in your DATABASES
如果您使用 dj-database-url 检查数据库中的架构
https://github.com/kennethreitz/dj-database-url
https://github.com/kennethreitz/dj-database-url
MySQL is
MySQL是
'default': dj_database_url.config(default='mysql://USER:PASSWORD@localhost:PORT/NAME')
It solves the same error even without the PORT
即使没有 PORT,它也能解决同样的错误
You set the password with:
您设置密码:
mysql -u user -p
回答by varra
Just create a file my.inifile in installation dir and have the below config as part of this file to solve this permanently.
只需在安装目录中创建一个文件my.ini文件,并将以下配置作为此文件的一部分来永久解决此问题。
[mysql]
user=root
password=root
回答by Muhammad
- open command line (run as admin)
- go into Mysql server bin folder
- run command:
mysqldump -u root -p mydbscheme > mydbscheme_dump.sql
- give your password here against root.
- 打开命令行(以管理员身份运行)
- 进入Mysql server bin文件夹
- 运行命令:mysqldump -u root -p mydbscheme > mydbscheme_dump.sql
- 在此针对 root 提供您的密码。
It will work perfect !!
它将完美运行!!
回答by Know Group
Try using following command it work.
尝试使用以下命令它工作。
mysql --user=root --password=root_password
回答by Artur Paszek
Why you can't just use mysqlsh?
为什么你不能只使用 mysqlsh?
PS C:\Users\artur\Desktop> mysqlsh --user root
MySQL Shell 8.0.17
Copyright (c) 2016, 2019, 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 '\?' for help; '\quit' to exit.
Creating a session to 'root@localhost'
Fetching schema names for autocompletion... Press ^C to stop.
Your MySQL connection id is 13 (X protocol)
Server version: 8.0.17 MySQL Community Server - GPL
No default schema selected; type \use <schema> to set one.
MySQL localhost:33060+ ssl JS >