MySQL command line won't open?

2019-03-15 10:07发布

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?

4条回答
Luminary・发光体
2楼-- · 2019-03-15 10:45

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

查看更多
Bombasti
3楼-- · 2019-03-15 10:50

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
查看更多
我只想做你的唯一
4楼-- · 2019-03-15 10:51

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.

查看更多
爷、活的狠高调
5楼-- · 2019-03-15 10:52

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. 
查看更多
登录 后发表回答