0

我有一个在联网计算机上运行的 MySQL 数据库。过去连接到它时我没有遇到任何问题。然而,突然之间(在重新启动和周末之后),我得到了

ERROR 1045 (28000): Access denied for user 'root'@'x.x.x.y'.

当我试图通过以下方式连接时,这非常奇怪:

mysql -h x.x.x.x -u root

出于某种原因,我的 IP 地址(最后一个“。”之后的最后几个数字)我试图连接到我输入的更改。

我正在运行 Ubuntu 12.10。

编辑:远程连接已经启动并且可以ping通。Mysql 在电脑上也能正常运行。

4

2 回答 2

3
You will need to reset the password.

First start the mysql server instance or daemon with the --skip-grant-tables option. (security setting)

Then Execute these statements.
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('your_new_password') where USER='root';
mysql> FLUSH PRIVILEGES;

Finally, restart the instance/daemon without the --skip-grant-tables option.

You should be able to connect with your new password.

# mysql -u root -p
Enter password: your_new_password`enter code here`

Hope this helps. 
于 2013-07-01T17:45:57.970 回答
0

您在-h标志后输入的 IP 地址/主机名是您要连接的 MySQL 服务器的 IP 地址/主机名。错误消息中的 IP 地址/主机名是您连接的计算机的 IP 地址/主机名。您可能更改了动态分配的 IP 地址,并且您的用户帐户未设置为允许从该帐户进行访问。

于 2013-07-01T17:33:56.253 回答