0

I am having trouble with migrating my Ruby on Rails MySQL database to Heroku server on Ubuntu 18.04. I use command

heroku run rake db:migrate

(I am in my app catalog of course.) I receive the error:

Can't connect to local MySQL server through socket 'socketname'

The socket exists and clearly is working because my app uses it to connect to the database while working just fine locally. None of the solutions suggested in other similar questions worked. I will appreciate any idea. :)

Kevin
  • 1

1 Answers1

0

If your file my.cnf (usually in the /etc/mysql/ folder) is correctly configured with

socket=/var/lib/mysql/mysql.sock

you can check if mysql is running with the following command:

mysqladmin -u root -p status

try changing your permission to mysql folder. If you are working locally, you can try:

sudo chmod -R 755 /var/lib/mysql/

Check this link Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (38)

nourza
  • 2,039
  • 2
  • 15
  • 28