MySQL login error 1045 (28000): Access denied for user ODBC@localhost

MySQL login error 1045 (28000): Access denied for user ODBC@localhost cover image
  1. Home
  2. Answers
  3. MySQL login error 1045 (28000): Access denied for user ODBC@localhost

I installed MySQL on a desktop PC (VISTA). But after typing “mysql” at the DOS prompt, I get an error message: “ERROR 1045 (28000): Access denied for user ‘ODBC’@’localhost’ (using password: NO)“. My question is how do I successfully login to use MySQL? I’ve heard of phpMyAdmin – isn’t this better? Thank you
Wayne

You cannot login at MySQL server with a simple mysql command at the prompt. It is bound to result in the MySQL login error 1045 (28000): Access denied error. Actually, the command is incomplete as the login details are missing.

Anyway, this is a very minor issue and can be solved quickly by using the correct MySQL login command at the terminal window.

Sponsored Links

Login at MySQL using the Command Line Client

The MySQL package comes with a Command Line Client (CLC) with which you can work with the database. The commands need to be typed in manually and this helps you in learning the language properly. I advise beginners to use the CLC because it provides a simple interface through which one can get a hands-on (literally) experience.

The MySQL Command Line Client can be launched from “All Programs” -> “MySQL” -> “MySQL Server 5.1” -> “MySQL Command Line Client“. You can also load it up from a terminal window, but simply typing mysql followed by the “Enter” key at the DOS prompt will throw the “ERROR 1045 (28000): Access denied for user ‘ODBC’@’localhost’ (using password: NO).

MySQL Error 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO)

ERROR 1045 (28000): Access denied for user is displayed because you are not providing a password

To successfully login at MySQL you need to provide the password. For instance, if you launch the MySQL Command Line Client (image below), it waits for you to type in the password.

MySQL Command Line Client (CLC): enter password to login at the server

A simple “mysql” command at the DOS prompt is insufficient for logging in at MySQL. You need to use:

>mysql -u root -p

Wherein, root is the username and should be changed if your login information is different. The program now waits for you to enter the password which was set up when MySQL was installed on the Windows computer.

Should you use MySQL clients like phpMyAdmin?
Yes you can install phpMyAdmin on a Windows 7 machine (or Vista, in your case), but I recommend using it only when you’ve mastered at least the basic SQL commands.

Answers MySQL Web Development