restore resend mysql to another machine after mysql coding problem error

  • 2020-05-12 06:22:38
  • OfStack

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 

Preliminary judgment should be the problem of mysql [the nature of generation research] :
In my.ini add the following:
 
[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 mysql server, problem resolved.

View the default encoding for creating mysql database:
show create database db_name;
Change the encoding of db that has been created:
alter database db_name character set utf8 collate utf8_general_ci;
View database related information:
mysql > status
View database related information 2:
mysql > show variables like 'char%';

Related articles: