2013-04-10 42 views
0

我在Ubuntu上使用mysql部署Rails應用程序,當我運行rake db:migrate時,出現錯誤Can't connect to local MySQL server through socket '/tmp/mysql.sock'在Ubuntu上連接mysql時出錯

順便說一下,我通過apt-get安裝了mysql。

回答

3

我得到這個頁面http://www.davideisinger.com/article/getting-started-with-ubuntu

這最後一步僅僅是Ruby on Rails的對答案。無論出於何種原因,Ubuntu將mysql.sock文件放在與大​​多數Linux發行版不同的地方,混淆了Rails。爲了將它指向正確的位置,創建以下符號鏈接:

ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock

,因爲在你的應用程序默認的database.yml寫​​這socket: /tmp/mysql.sock