Access denied to mysql

孤者浪人 提交于 2020-01-03 05:08:08

问题


On Windows 7, I am trying to use mysql (installed through WAMP) through the command line without explicitly specifying my username and password, like below

shell> mysql 

To do that, I need to change the configuration file for MySQL, which is supposedly my.ini. I did just that

...
# The following options will be passed to all MySQL clients
[client]
password    = my_password
port        = 3306
socket      = /tmp/mysql.sock
...

Yet when I try to access mysql, I still get the message

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

How can I fix this?

My my.ini is in

C:\wamp\bin\mysql\mysql5.5.24

Note that the password specified above, my_password, is not my real password and was specified in the file without quotations.

EDIT:

Okay, the above approach works - it allowed me to use mysql through the CLI - but only when I have WAMP on... Why? When it's not on, I get denied access like above...


回答1:


Its not particularly secure but if you add the account name to the my.ini file as well as the password it will work for you

# The following options will be passed to all MySQL clients
[client]
user        = "Fred"
password    = "Bloggs"
port        = 3306
socket      = /tmp/mysql.sock
...


来源:https://stackoverflow.com/questions/20674991/access-denied-to-mysql

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!