Mysql - 1045 - 用户 'user'@'localhost' 访问被拒绝(使用密码:是) [英] Mysql - 1045 - Access denied for user 'user'@'localhost' (using Password: Yes)
问题描述
我已经在本地 Windows 服务器上独立安装了 MYSQL 5.6.最近,我更改了服务器的本地 IP 并在我的网络中重新配置了它,但现在我无法访问我的数据库.它给了我这个错误:
I have installed MYSQL 5.6 stand-alone on a local windows server. Recently, I changed the local IP of my server and reconfigured it in my network, but now I am not able to access my databases. It is giving me this error:
1045 - 用户 'user'@'localhost' 的访问被拒绝(使用密码:是)
1045 - Access denied for user 'user'@'localhost' (using Password: Yes)
使用 localhost 作为服务器名称时出现上述错误.此外,我可以通过 root 用户名连接到 localhost,但它没有向我显示我以前拥有的原始数据库.
The above error is coming while using localhost as the server name. Also, I am able to connect to localhost through root username, but it is not showing me the original DB's which I had before.
同样在服务器 IP 更改之前,我能够通过服务器的旧 IP 访问 MySQL 服务器.像主机名: xx:xx:xx:xx ,用户:用户,通过:通过......但它也给了我一个错误:
Also before the server IP change I was able to access the MySQL server through the old IP of the server. like host name: xx:xx:xx:xx , user: user, pass: pass .... But it is also giving me an error:
2003 - 无法连接到我的 'xx:xx:xx:xx' (10038) 上的 sql 服务器
2003 - cannot connect to my sql server on 'xx:xx:xx:xx' (10038)
我已尝试在以下链接上定义解决方案并运行以下查询:https://dev.mysql.com/doc/mysql-windows-excerpt/5.6/en/resetting-permissions-windows.html
I have tried the solution define on following link and run following query: https://dev.mysql.com/doc/mysql-windows-excerpt/5.6/en/resetting-permissions-windows.html
设置密码为'root'@'%' = PASSWORD('test');
SET PASSWORD FOR 'root'@'%' = PASSWORD('test');
这开始给出 root 用户名和密码test"拒绝访问的错误
and this is starting giving error of access denied for the root username and password 'test'
任何机构都可以帮助我解决这个问题.
Can any body help me to resolve this.
推荐答案
以 root 身份连接到 127.0.0.1.
Connect to 127.0.0.1 as root.
使用旧 IP 地址更新 mysql 用户行的 IP 地址.
Update IP address for mysql user row with old IP address.
use mysql;
update user set host='NEWIP' where host='OLDIP' and user='root';
flush privileges;
再次尝试连接.
如果您没有 root 访问权限,请重置权限并重试.
If you don't have root access, reset permissions and try again.
http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html
这篇关于Mysql - 1045 - 用户 'user'@'localhost' 访问被拒绝(使用密码:是)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!