在Ubuntu上连接mysql出错



我在Ubuntu上使用mysql部署Rails应用程序,当我运行rake db:migrate时,我得到了错误Can't connect to local MySQL server through socket '/tmp/mysql.sock'

我在这一页得到了答案http://www.davideisinger.com/article/getting-started-with-ubuntu

最后一步只适用于Ruby on Rails。不知道什么原因,Ubuntu把mysql。与大多数Linux发行版不同的地方放置了sock文件,这让Rails感到困惑。为了将其指向正确的位置,创建以下符号链接:

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

,因为您的默认数据库。socket: /tmp/mysql.sock

最新更新