Recently, I was working on a project where I wanted to use the mysql database for deployment. The general settings are as follows: 1. database. ymlproduction: adapter: mysqlencoding: utf8reconnect: falsedatabase: new_parkpool: 5 username: ****** password: ********** host: localhostsocket: varrunmysqld
Recently, I was working on a project where I wanted to use the mysql database for deployment. The general settings are as follows: 1. database. yml production: adapter: mysql encoding: utf8 reconnect: false database: new_park pool: 5 username: ****** password: ********** host: localhost socket:/var/run/mysqld/
Recently, I am working on a project where I want to use the mysql database for deployment. Follow the general settings:
1, database. yml
Production:
Adapter: mysql
Encoding: utf8
Reconnect: false
Database: new_park
Pool: 5
Username :******
Password :*********
Host: localhost
Socket:/var/run/mysqld. sock
2. httpd. conf of apache2
ServerName localhost
DocumentRoot/home/sciencepark/RubyCode/NewPark/public
Allow from all
RailsEnv production
Options -MultiViews
3. Run the following command: rake db: setup RAILS_ENV = "production ". Seeds. rb contains Chinese characters.
In this case, the following error occurs when accessing the Website: We're sorry, but something went wrong.
It is estimated that it is a Chinese problem of mysql.
Many posts on the Internet show you how to solve the problem of Chinese garbled characters in mysql. add "default-character-set = utf8" to [client] and [mysqld] In the cnf file, after mysql is restarted, 'can't connect to local MySQL server through socket '/var/run/mysqld appears. sock's error!
After the added content is removed, mysql can be started normally, but the Chinese Garbled text problem persists. I don't know how it works!
Original article address: mysql Chinese garbled characters in rails deployment. Thank you for sharing it with me.