[Client]
[Mysqld]
Collation_server = utf8_general_ci
Character_set_server = utf8
[Mysql]
[Mysqldump]
3. Data Table Encoding
/*! 40101 SET @ saved_cs_client = @ character_set_client */;
/*! 40101 SET character_set_client = utf8 */;
CREATETABLE 'access '(
'Id' int (8) unsigned not null AUTO_INCREMENT,
'Role _ id' smallint (6) unsigned not null,
'Node _ id' smallint (6) unsigned not null,
Primary key ('id '),
KEY 'nodeid' ('node _ id ')
) ENGINE = MyISAM AUTO_INCREMENT = 364DEFAULTCHARSET = utf8;
/*! 40101 SET character_set_client = @ saved_cs_client */;
4. During the transfer
Sometimes you need to store the database, but if the database is transferred to the new database, it will be garbled. You may need:
# Mysqldump -- default-character-set utf8-u root-pmypass mydb> mydb. SQL
5. Query
Sometimes, although the SQL file encoding of mysql, database, data table, and exported data is normal, garbled characters still occur during query, probably because encoding is also required during query, function names are similar. in php + mysql, they are:
Mysql_query ('set names utf8 ');
Above.