Solve the problem of garbled Chinese characters in MySql database

When the device was connected to the cloud service, I encountered a problem with the Chinese character code in the Mysql database. After checking the information online, I finally solved it. Special record:

C for linux

mysql_query(conn_ptr,"set character_set_results=utf8"); //读库

Read data....

mysql_query(conn_ptr,"set names 'utf8'");//写库

Insert data/modify data...

PHP

mysql_query("set names 'UTF8'");

Insert data/read data/modify data

...

Guess you like

Origin blog.csdn.net/llq_the7/article/details/123108179
Recommended