使用 Homebrew 在 OSX 10.7 (Lion) 上设置 MySQL 服务器
我已经使用 Homebrew 成功安装了 MySQL。但是,每当我键入命令 mysql 时,我都会收到此错误: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
我怀疑这是一个权限问题,因为我已经确认我的系统正在正确的位置寻找 MySQL。然而,我是 Unix(OSX) 的新手,不知道如何解决这个问题。
我正在使用 OSX 10.7 (Lion)
which mysql
生成 /usr/local/bin/mysql
I have successfully installed MySQL using Homebrew. However, whenever I type the command mysql I receive this error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
I suspect this is a permission problem, as I have confirmed my system is looking for MySQL in the right location. However, I a novice with Unix(OSX) and don't know how to rectify the problem.
I am using OSX 10.7 (Lion)
which mysql
produces /usr/local/bin/mysql
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您输入“mysql”时,您正在运行 MySQL 客户端。客户端需要与服务器进行通信。如果您只是运行“mysql”而不带任何参数,它会假设您正在尝试使用用户名作为您运行命令的用户来连接到位于“localhost”上的 mysql 服务器,并且没有密码。
从错误来看,您的服务器尚未运行。输入以下命令启动它:
mysql.server 启动
When you type 'mysql' you are running the MySQL client. The client needs to communicate with the server. If you simply run 'mysql' without any argument it assumes you are trying to connect to a mysql server that is located on 'localhost' using the user name as the user you are running the command as and without a password.
From the error it seems your server is not running yet. Start it by typing:
mysql.server start