I get this error when I run rake db:create
root@guidir-smaill-group-1-po7p:/home/acc/site/site# RAILS_ENV=production rake db:create
#<Mysql2::Error: Lost connection to MySQL server at 'reading initial communication packet', system error: 0>
Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "pool"=>5, "username"=>"root", "password"=>"pass", "host"=>"173.144.230.182", "database"=>"dbname"}, {:charset=>"utf8", :collation=>"utf8_unicode_ci"}
(If you set the charset manually, make sure you have a matching collation)
The error seems fairly common and I've read a bunch of posts here on SO on how that fixed it. But they all include removing and re installing MySQL with a command like these
export ARCHFLAGS="-arch i386 -arch x86_64" gem install mysql -- --with-mysql-dir=/usr/local \ --with-mysql-config=/usr/local/bin/mysql_config
sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Problem is that im using an SQL instance on google cloud and I dont want to uninstall the mysql setup they have there. How can I get the same result without re installing mysql so I can run rake db:create
successfully?