The command for mysql to set encoding is: [SET character_set_database = utf8;]. We can view the database encoding by executing the [SHOW VARIABLES LIKE '%set%';] command.
1. Check the encoding
(Recommended tutorial: mysql video tutorial )
SHOW VARIABLES LIKE '%set%';
2. Set the encoding to UTF-8
SET character_set_client = utf8; SET character_set_connection = utf8; SET character_set_database = utf8; SET character_set_database = utf8; SET character_set_results = utf8; SET character_set_server = utf8; SET character_set_system = utf8;
Related recommendations: php training
The above is the detailed content of What is the command to set encoding in mysql?. For more information, please follow other related articles on the PHP Chinese website!