15

I just installed the latest version of MySQL. Until Now I had it on Windows XP but I wanted to install this on another computer with Windows 7.

Even after configuring everything correctly, the MySQL client won't show up in the Start Folder. So I went to the bin folder of MySQL and tried opening mysql.exe but it would immediately close down.

I then tried opening mysql.exe in cmd & this is what I get

C:\Program Files\MySQL\MySQL Server 5.5\bin>mysql
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: N O)

Any Ideas how I can get this to work?

OMG Ponies
  • 300,587
  • 73
  • 490
  • 482
Gaurav
  • 671
  • 3
  • 8
  • 21
  • 1
    Did you specify any sort of logon credentials for a user when you configured it? root? admin? administrator, etc.? If so, you need to call the prompt with "mysql -u -p" and it will provide you with a prompt to enter your password. Upon successfully entering the password, you should get to the mysql command prompt, prefixed with "mysql>" instead of "C:\whatever>" – Eaglebird Dec 22 '10 at 11:01
  • Yeah you are right. That did work for me. Thanks. But how do I configure it such that MySQL has its own command window and I can log on just by entering the password. – Gaurav Dec 22 '10 at 12:04
  • Create a shortcut for it – Mchl Dec 22 '10 at 12:38
  • I didn't mean a shortcut. How would a shortcut prevent me from first changing the dir to bin & then entering `mysql -u root -p` everytime. I want to be able to just enter my password like in a regular mysql client. – Gaurav Dec 22 '10 at 20:16

4 Answers4

16

Provide username (root) C:\Program Files\MySQL\MySQL Server 5.5\bin>mysql -uroot

Default passsword is blank, but if you set it, you will need to provde password as well

Mchl
  • 58,281
  • 9
  • 105
  • 116
  • 4
    I did `mysql -u root -p` and then it prompted me for password. This seems to have worked. – Gaurav Dec 22 '10 at 10:59
  • 4
    @Mchl displaying this error "ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)" – Akash Jul 09 '14 at 14:39
  • getting the same error "ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)". – Kunal Tyagi Sep 18 '20 at 14:57
13

I don't recall where I first read it, but when facing this problem before, I found that I had to manually turn on a service:

  1. Windows key+R and type Run and hit "enter"
  2. Type "services.msc", hit "OK"
  3. Find "MySQL56", right-click and choose "Start"
  4. You should now be able to log in with no trouble

That's the solution that worked for me; hopefully it helps others out there.

Md Nakibul Hassan
  • 2,116
  • 1
  • 13
  • 18
Herschel
  • 131
  • 1
  • 2
1

What @Herschel said is right if you follow his steps 1-4 then try to log in with your password in command line you'll have no trouble.

You can also make this run automatically as a service, something which you need when running it on a server.

  1. Open Run
  2. Type "services.msc" click ok
  3. Find the MySQL service
  4. Right-click properties then go down to startup type:
  5. Change it to automatic
Crouch
  • 776
  • 2
  • 15
  • 31
0

I followed these steps and it worked for me:

1. Open Command prompt in admin and go to the location of Mysql bin folder and type -  
    C:\ProgramFile\mysql\bin>mysql -u root -p <password>
2. Then the prompt asks for the password. This is the password or the root user which 
    you had set during installation of mysql. 
3. Type the password and you will login in to mysql. 
4. Also make sure your mysql service is running in the backend by going to the 
   windows service panel and check whether the mysql service is running. 
SunilA
  • 463
  • 4
  • 16