Mysql Chinese garbled characters in rails deployment

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.