你能帮我解决这个问题吗?
Could you help me solve this problem ?
当我尝试单击查询数据库"时在 Mysql 工作台的数据库菜单下.它给了我一个错误:
When I try to click "query database" under database menu in Mysql workbench. it gives me an error:
无法连接到数据库服务器
Cannot Connect to Database Server
您的用户root"从您的主机到服务器的连接尝试失败127.0.0.1:3306: 无法连接到 '127.0.0.1'(10061) 上的 mysql 服务器
Your connection attempt failed for user 'root' from your host to server at 127.0.0.1:3306:Can't connect to mysql server on '127.0.0.1'(10061)
请:
该问题可能是由于在升级到 ubuntu 16.04 期间未设置密码时默认为 root 用户启用了套接字身份验证.
The issue is likely due to socket authentication being enabled for the root user by default when no password is set, during the upgrade to ubuntu 16.04.
解决方案是恢复到本机密码身份验证.您可以通过以下方式使用套接字身份验证登录 MySQL 来完成此操作:
The solution is to revert back to native password authentication. You can do this by logging in to MySQL using socket authentication by doing:
sudo mysql -u root
登录后:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
这将恢复到本机(旧的默认)密码身份验证.
which will revert back to the native (old default) password authentication.
现在使用 password 作为 MySQL 需要的密码.
Now use password as the password whenever required by MySQL.
这篇关于无法连接到数据库服务器(mysql 工作台)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!