简体   繁体   中英

Rails: can't migrate database

When I'm trying migrate database with bundle exec rake db:migrate I get an error Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) . How can I fix it?

There may be different reasons. Either as vanda says your mysql server simply isn't running.

Or it placed the mysql.sock file in a different folder. In this case you can add the following line to config/database.yml:

socket: /var/run/mysqld/mysqld.sock

(Obviously the path must be the right one, this may differ between installs and you may have to find the right path first)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM