2013-10-18 46 views
3

我一直在運行MySQL Ver 14.14 Distrib 5.6.10, for osx10.6 (x86_64)一段時間沒有問題。今晚我不得不重啓我的筆記本電腦,一會兒開始後,我試圖訪問一個開發數據庫。我得到了以下錯誤:在osx上安裝兩個mysql?

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似乎在尋找。值得注意的是,系統首選項工具以及mySQL Workbench服務器工具也沒有成功啓動服務器。任何想法從哪裏開始?

+0

您是否使用Homebrew? – jcm

+0

是啊,因爲它安裝在我的地窖裏,所以必須有 - 我只能想到的是我在/ usr/local/mysql中安裝了mysql客戶端,然後通過自制軟件在'/ usr/local/Cellar'中安裝了服務器。根據我的回答,現在就開始工作了,但仍然不確定「真正的」解決方案是什麼 – dax

回答

1

this site

$ sudo mv my.cnf old_my.cnf 
$ Password: 
$ sudo /usr/local/mysql/support-files/mysql.server start 
    Starting MySQL 
    SUCCESS! 

它的工作原理!然而,值得注意的是,這可能不是'最好的'方式 - 正如Brad Quellhorst在評論中指出的那樣:

The better advice would be "Remove anything you recently added to my.cnf and remove the file as a last resort" Unless you already have a bare-defaults my.cnf, by removing it you're destroying any configuration options in favor of defaults, which among other things, are rather insecure. Binding MySQL to all open IPs and removing any caching, replication, and data information is not the solution to a typo'd configuration statement.