简体   繁体   中英

how to overcome ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO) permanently

when am trying to open mysql in windows cmd by typing mysql. the following error is occuring.

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.

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:

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

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

mysql

without specifying a username will attempt to connect with the non-existent ODBC username, and give:

Error 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: 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.

You need to create an user "ODBC" for MySql with no password. Do that in PHPMyAdmin. That will solve your problem.

But remember, if it's only your local development environment, no problem. It'll create a serious security hole in your production environment.

没有密码的用户 ODBC

问题解决了

我试过了,它奏效了:

C:\cd MySQL installed path\MySQL -uyourusername -pyourpassword
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..

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.

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.

The FILE privilege is separate from all the others and must be granted to the user running the script.

GRANT FILE ON *.* TO 'asdfsdf'@'localhost';

If you are using dj-database-url check the schema in your DATABASES

https://github.com/kennethreitz/dj-database-url

MySQL is

'default': dj_database_url.config(default='mysql://USER:PASSWORD@localhost:PORT/NAME') 

It solves the same error even without the PORT

You set the password with:

mysql -u user -p 

Just create a file my.ini file in installation dir and have the below config as part of this file to solve this permanently.

[mysql]
user=root
password=root

Try this command: mysql -uroot -p then it will ask for password enter root as the password.

I have found the answer for this:

enter mysql -u user -p

this will leads to Enter Password .

Then enter the password which you have given...

below is the example: *****C:\Users\admin> mysql -u root -p

** Enter password : **********************

Welcome to the MySQL monitor. Commands end with; or \g. Your MySQL connection id is 26 Server version: 8.0.31 MySQL Community Server - GPL

This is worked for me

  1. open command line (run as admin)
  2. go into Mysql server bin folder
  3. run command: mysqldump -u root -p mydbscheme > mydbscheme_dump.sql
  4. give your password here against root.

It will work perfect !!

尝试使用以下命令它工作。

mysql --user=root --password=root_password

Why you can't just use 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 >

Windows 终端上的 mysqlsh(图片)

You can create user with no password in phpmyadmin and it solves the problem! Lebbar Abdelhadi,

It seems like You haven't set the Mysql server path, Set Environment Variable For MySql Server. Then restart the command prompt and enter mysql -u root-p then it asks for a password enter it. Thank you. Happy learning!

import mysql.connector as conn

conn.connect(host = 'localhost', user = 'root' , passwd = 'xxx')

xxx = your password for MySQL & user name can be different from root also. Check your MySQL userid & change it accordingly

( we can connect to SQL from python Jupiter notebook using above syntax)

Let me what worked for me -

Step 1 - In cmd, give a command

set path=%PATH%;set path=%PATH%;C:\Program Files\MySQL\MySQL Server 8.0\bin

[Note - make sure you are replacing 'C:\Program Files\MySQL\MySQL Server' with your 'MySQL server path' above]

Step 2 - type,

mysql -u user -p

This will ask for password and you are good to go but sometimes it does not work...

Then try this

Alternative of Step 2 -

--user=root --password=1234

Must replace your username and password with above

Step 3 - Check out by

mysql --version

I hope this may help...

I encountered this problem today. I tried mysql -u root -p , but it doesn't work. I restarted the mysql service by two commands: net stop mysql and net start mysql then tried the command mysql . It worked.

i entered in Mysql Workbench and i changed the password. It seem the password was expired. it works!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM