An error is returned when mysql encoding is restored to another machine.

Source: Internet
Author: User

As follows: Copy codeThe Code is as follows: Warning at/admin/assets/add/
Incorrect string value: '\ xE5 \ x93 \ x88 \ xD5 \ x92 \ x88...' for column 'name' at row 1
Request Method: POST
Request URL: http: // 127.0.0.1: 8000/admin/assets/add/
Django Version: 1.2.3
Exception Type: Warning
Exception Value:
Incorrect string value: '\ xE5 \ x93 \ x88 \ xD5 \ x92 \ x88...' for column 'name' at row 1
Exception Location:/usr/lib/pymodules/python2.7.1/MySQLdb/cursors. py in _ warning_check, line 82
Python Executable:/usr/bin/python
Python Version: 2.7.1

The preliminary judgment should be the problem of mysql [the essential issue of research on behalf of]:
Add the following in my. ini:Copy codeThe Code is as follows: [client]
Character-set-client = utf8
Default-character-set = utf8
[Mysqld]
Character-set-server = utf8
Character-set-filesystem = utf8 [mysql]
Init_connect = 'set NAMES utf8'
[Mysql]
Default-character-set = utf8

Restart the mysql server to solve the problem.

View the default encoding used to create a mysql database:
Show create database db_name;
Change the encoding of the created db:
Alter database db_name character set utf8 collate utf8_general_ci;
View database information:
Mysql> status
View database information 2:
Mysql> show variables like 'Char % ';

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.