拒绝访问mysql [英] Access denied to mysql

查看:81
本文介绍了拒绝访问mysql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows 7上,我试图通过命令行使用mysql(通过WAMP安装),而没有像下面那样显式指定用户名和密码

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 

为此,我需要更改MySQL的配置文件,该文件应该是my.ini.我就是这样做的

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
...

但是当我尝试访问mysql时,我仍然收到消息

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

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

我该如何解决?

我的my.ini在其中

My my.ini is in

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

请注意,上面指定的密码my_password不是我的真实密码,并且是在文件中没有引号指定的.

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

好的,以上方法有效-它允许我通过CLI使用mysql-但仅当我打开WAMP时...为什么?当它不开启时,我会像上面一样被拒绝访问...

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...

推荐答案

它不是特别安全,但是如果您将帐户名和密码添加到my.ini文件中,它将为您工作

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
...

这篇关于拒绝访问mysql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆