Mysql2::Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
ファイルがないとか、権限がおかしいのかと思ったら、
ただMySQLが起動してないだけだった。
$ rake db:create
で次のエラーが出る。
#<Mysql2::Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)>
Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "pool"=>5, "username"=>"root", "password"=>nil, "host"=>"localhost", "database"=>"pictweet2_development"}, {:charset=>"utf8", :collation=>"utf8_unicode_ci"}
(If you set the charset manually, make sure you have a matching collation)
調べたら、MySQLが起動してないだけでは?となったので、
起動コマンドをするが、次ではダメで、「sudo」を頭につけたら解決。
×
$ mysql.server start
=>
Starting MySQL
. ERROR! The server quit without updating PID file
○
$ sudo mysql.server start
=>
パスワードを入力して、
Starting MySQL
.. SUCCESS!