我一直在运行MySQL Ver 14.14 Distrib 5.6.10, for osx10.6 (x86_64)
一段时间没有任何问题。今晚我不得不重新启动我的笔记本电脑,一段时间后,我开始尝试访问开发数据库。我收到以下错误:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
这是命令和响应:
$ which mysql
#=> mysql: aliased to nocorrect mysql
$ unset TMPDIR
$ mysql_install_db
#=> FATAL ERROR: Could not find ./bin/my_print_defaults
$ sudo /usr/local/mysql/support-files/mysql.server start
#=> ERROR! The server quit without updating PID file (/usr/local/mysql/whoamis-MacBook-Pro.local.pid).
$ mysqld
#=> 2013-10-19 00:11:08 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2013-10-19 00:11:08 5029 [Warning] Can't create test file /usr/local/var/mysql/whoamis-MacBook-Pro.lower-test
2013-10-19 00:11:08 5029 [Warning] Can't create test file /usr/local/var/mysql/whoamis-MacBook-Pro.lower-test
mysqld: Can't change dir to '/usr/local/var/mysql/' (Errcode: 2 - No such file or directory)
2013-10-19 00:11:08 5029 [ERROR] Aborting
2013-10-19 00:11:08 5029 [Note] Binlog end
2013-10-19 00:11:08 5029 [Note] mysqld: Shutdown complete
$ usr/local/Cellar/mysql
果然,这里也有一个mysql安装。所以/usr/local/mysql
中有一个,/usr/local/Cellar/mysql
中有一个,但/usr/local/var
中没有一个mysqld
,至少看起来像{{1}}。值得注意的是,系统首选项工具以及mySQL Workbench服务器工具也无法成功启动服务器。知道从哪里开始吗?
答案 0 :(得分:1)
$ sudo mv my.cnf old_my.cnf
$ Password:
$ sudo /usr/local/mysql/support-files/mysql.server start
Starting MySQL
SUCCESS!
有效!然而,值得注意的是,这可能不是“最佳”方式 - 正如Brad Quellhorst在评论中指出的那样:
更好的建议是“删除你最近添加到my.cnf的任何内容并删除该文件作为最后的手段”除非你已经有一个简单的默认my.cnf,删除它你会破坏任何配置选项支持默认值,其中包括相当不安全的默认值。将MySQL绑定到所有打开的IP并删除任何缓存,复制和数据信息不是错误配置语句的解决方案。