hasen's tech life

Twitter: @hasen

Ruby on Railsで"Can't connect to local MySQL server through socket '/tmp/mysql.sock'"というエラーが出たので対応.

# Ruby on Railsで"Can't connect to local MySQL server through socket '/tmp/mysql.sock'"というエラーが出たので対応.

# データベースの設定ファイルに"socket"を設定.
$ vi config/database.yml
++ socket: <%= ENV['MYSQL_SOCKET'] %>

$ vi .env
++ MYSQL_SOCKET='/PATH/TO/mysql.sock'

$ rails s

Vagrantで"/sbin/mount.vboxsf: mounting failed with the error: No such device"というエラーが出たので対応した.

# Vagrantで"/sbin/mount.vboxsf: mounting failed with the error: No such device"というエラーが出たので対応した.

$ vagrant up
$ vagrant ssh
$ sudo yum install -y kernel-devel
$ uname -r
> 2.6.32-504.el6.x86_64
$ echo $KERN_DIR
>
$ export KERN_DIR=`uname -r`
$ echo $KERN_DIR
> 2.6.32-504.el6.x86_64
$ sudo yum update -y
$ exit
$ vagrant reload