0

I tried to run rake db:setup, but I got this error. I want to my mysql socket be in this path (/tmp/mysql.sock), but I think it is not.. How can I change the socket path?

I'm using Ubuntu

imtk
  • 1,510
  • 4
  • 18
  • 31
  • The socket's path is defined in `/etc/mysql/my.cnf`. Ubuntu's default socket location is probably `/var/run/mysqld/mysqld.sock` and you should change your Rails configuration (in database.yml) to point at the MySQL socket at that location rather than change MySQL to use a different socket path. – Michael Berkowski Dec 20 '14 at 15:00
  • I want to change MySQL to use a different socket path because I'm running a Rails project by the company I work. And they configure to use tmp/mysql.sock – imtk Dec 20 '14 at 15:11
  • Okay then, fair enough. Change it in `/etc/mysql/my.cnf` to your desired path and restart the mysql service `sudo service mysql restart`. – Michael Berkowski Dec 20 '14 at 15:13
  • You could also create a symlink to your desired socket location, which would avoid having to modify your daemon config http://stackoverflow.com/questions/4448467/cant-connect-to-local-mysql-server-through-socket-var-lib-mysql-mysql-sock/21745101#21745101 – Michael Berkowski Dec 20 '14 at 15:16
  • Do you know how to edit system files in Ubuntu? If you use Vim as your editor `sudo vim /etc/mysql/my.cnf` then restart the service. – Michael Berkowski Dec 20 '14 at 15:17
  • Or if you don't know how to use vim/vi, use `nano` or whatever your text editor of choice is, but you will need admin privileges via `sudo` to do it. – Michael Berkowski Dec 20 '14 at 15:17
  • I tried with nano. Just edit socket path. But it wouldn't work. – imtk Dec 20 '14 at 15:34
  • What wouldn't work? Did you change the socket path for both the `[server]` and `[client]` sections of my.cnf? Did you `sudo service mysql restart` afterward? – Michael Berkowski Dec 20 '14 at 15:36

0 Answers0