Solving ERROR 1045 (28000): Access denied for user ‘ODBC’@’localhost’ (using password: NO)

1045 (28000): access denied for user ‘odbc’@’localhost’ (using password: no)

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.

Syntax:

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.

Command:

Result:

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. 

Warning:

mysql: [Warning] Using a password on the command line interface can be insecure.

For example, our password to access MySQL is 123456.

Command:

mysql --user=root --password=123456

Or you can use the following command that is the same as the above one.

Command:

mysql -uroot -p123456

Result:

Summary

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:

Leave a Reply

Your email address will not be published. Required fields are marked *