If you are having trouble with the error “1045 (28000): Access denied for user ‘odbc’@’localhost’ (using password: no)” when starting MySQL, keep reading our article. We will give you a few methods to handle the problem.
Reason for “1045 (28000): Access denied for user ‘odbc’@’localhost’ (using password: no)”
When working with MySQL, people usually get the error when starting MySQL by the command
mysql in the Command Prompt.
We all see that the error mentions two things: the ODBC user has no permission to access and no password used. The root of the problem is that the ODBC user is in the Windows system instead of in the system database. Because the access is relative to the database – a secure system – there is always a password.
By default, the user’s name to access the database is root. So, you need to access the database under root permission and provide your password that is initiated the first time when installing MySQL.
Let’s move on. We will discover a few methods to solve the problem.
Solution to the problems
Starting MySQL as the root user
Try to access MySQL with a user named root, and you will be successful.
mysql -u root -p
With -u representing the username, the word root follow means you use username root while -p represents for password. After entering the command, the system will require you to enter the password for the root. Fill in the password you registered when installing MySQL, and you will access MySQL successfully.
Provide user and password when starting MySQL
Another way to access MySQL is by using the command that consists of the username and the password. You can also fill in your username and password like below, but the system will send you a warning because people can see your password, and it is considered insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
For example, our password to access MySQL is 123456.
mysql --user=root --password=123456
Or you can use the following command that is the same as the above one.
mysql -uroot -p123456
In summary, the error “1045 (28000): Access denied for user ‘odbc’@’localhost’ (using password: no)” occurs when you access MySQL with an unregistered username and without a password. You can follow one of our solutions to solve the problem, but we strongly recommend using the first one that is safe and secure.
You can read more other articles here, thanks for reading!
Maybe you are interested:
- Fix MySQL ERROR 1452 a foreign key constraint fails
- How To MySQL Split String By Delimiter
- Error 1273 (Hy000) At Line 25 Unknown Collation: ‘Utf8mb4_0900_Ai_Ci’
My name is Robert Collier. I graduated in IT at HUST university. My interest is learning programming languages; my strengths are Python, C, C++, and Machine Learning/Deep Learning/NLP. I will share all the knowledge I have through my articles. Hope you like them.
Name of the university: HUST
Programming Languages: Python, C, C++, Machine Learning/Deep Learning/NLP