Home >Database >Mysql Tutorial >How to set the mysql encoding format on the command line?
How to set the mysql encoding format on the command line: 1. Log in to mysql on the command line and enter the mysql command line editing mode; 2. Use the SET command to set the mysql encoding format, the syntax is "set character_set_..=utf8 ".
Problem description: When using JDBC to insert data into mysql, the Chinese characters are garbled (Chinese characters are displayed with ?)
Solution: eclipse and each java file and encoding in eclipse must be consistent with the mysql database and set to utf8. Note: It is not enough to set mysql to utf-8 when installing and creating tables
1. Log in to mysql
Enter the bin directory under the mysql installation path from the command line and enter the mysql command line editing mode
##2. SHOW VARIABLES LIKE 'character_set_%' to view various encoding formats 3. Use the SET command to change the formats that are not utf-8 to utf-8 in sequence; set character_set_client=utf8; //Set the client encoding to utf8set character_set_connection=utf8; // set character_set_database=utf8; //set character_set_results=utf8; //set character_set_server=utf8; //set character_set_system=utf8; //mysql video tutorial )
The above is the detailed content of How to set the mysql encoding format on the command line?. For more information, please follow other related articles on the PHP Chinese website!