Getting this error when trying to create a DB with rake db:create on google could SQL server

杀马特。学长 韩版系。学妹 提交于 2019-12-24 16:29:00

问题


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?

来源:https://stackoverflow.com/questions/36905520/getting-this-error-when-trying-to-create-a-db-with-rake-dbcreate-on-google-coul

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!