Mysql database garbled and encoding screening

Source: Internet
Author: User

[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.

Related Article

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.