想要更改mysql root的密码,但出现错误
我使用 macports 安装 Mysql5。但是,当尝试为 root 帐户创建密码时,我收到此错误:
sh-3.2# /opt/local/lib/mysql5/bin/mysqladmin -u root password 123456
/opt/local/lib/mysql5/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock' (61)'
Check that mysqld is running and that the socket: '/opt/local/var/run/mysql5/mysqld.sock' exists!
如何解决此问题?
I install Mysql5 using macports. But when trying to create password for the root account, I got this error:
sh-3.2# /opt/local/lib/mysql5/bin/mysqladmin -u root password 123456
/opt/local/lib/mysql5/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock' (61)'
Check that mysqld is running and that the socket: '/opt/local/var/run/mysql5/mysqld.sock' exists!
How to fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
检查 mysql 守护进程是否正在运行
如果是,您应该看到类似以下内容:
如果幸运的话,您将看到 --socket 参数准确指定套接字文件所在的位置。如果它与 mysql 客户端正在查找的路径 (/opt/local/var/run/mysql5/mysqld.sock) 不同,那么您可以手动将其指定为命令行参数之一。
另外,您应该检查 /etc/my.cnf 是否存在并且设置正确,这里是 my.cnf 的示例:
希望这有帮助,如果您仍然遇到问题,请消除疑问
Check to see if the mysql daemon is running
If it is you should see something like:
If you are lucky you will see the --socket argument specifying exactly where your socket file is located. If it is somewhere different than the path your mysql client is looking for (/opt/local/var/run/mysql5/mysqld.sock), then you can specify it manually as one of the command line arguments.
Also, you should check to see if /etc/my.cnf exists and is setup properly, here is an example my.cnf:
Hope this helps, fire away with questions if you are still having issues
检查您的发行版的默认套接字是什么。您还可以尝试使用 TCP4 上的连接:
或者,如果您找到了套接字的路径(在 mysql 的配置文件中),您可以使用类似以下内容的内容:
Check what is the default socket for your distribution. You can also try connectiong on TCP4 using:
Or if you have found the path to your socket (in mysql's config file) you can use somthing like: