Today, we will introduce the actual operation steps for setting all the parameters of the MySQL character set to UTF8, this article uses the actual application code that sets all parameters as UTF8 In the MySQL character set to introduce the actual operations. The following is the main content of the text. MySQL character set all parameters are set to UTF8: MySQL (and P
Today, we will introduce the actual operation steps for setting all the parameters of the MySQL character set to UTF8, this article uses the actual application code that sets all parameters as UTF8 In the MySQL character set to introduce the actual operations. The following is the main content of the text. MySQL character set all parameters are set to UTF8: MySQL (and P
Today, we will introduce the actual operation steps for setting all the parameters of the MySQL character set to UTF8, this article uses the actual application code that sets all parameters as UTF8 In the MySQL character set to introduce the actual operations. The following is the main content of the text.
Set all MySQL character set parameters to UTF8: After installation is complete, MySQL (the best combination with PHP) has been set to utf8
But as shown below:
- MySQL (best combination with PHP)> show variables like 'collation _ % ';
- + ---------------------- + ------------------- +
- | Variable_name | Value |
- + ---------------------- + ------------------- +
- | Collation_connection | latin1_swedish_ci |
- | Collation_database | utf8_general_ci |
- | Collation_server | utf8_general_ci |
- + ---------------------- + ------------------- +
- 3 rows in set (0.00 sec)
- MySQL (best combination with PHP)> show variables like 'character _ set _ % ';
- + -------------------------- + ------------------------------------------------ +
- | Variable_name | Value |
- + -------------------------- + ------------------------------------------------ +
- | Character_set_client | latin1 |
- | Character_set_connection | latin1 |
- | Character_set_database | utf8 |
- | Character_set_results | latin1 |
- | Character_set_server | utf8 |
- | Character_set_system | utf8 |
- | Character_sets_dir | D: \ data \ MySQL (the best combination with PHP) Server 4.1 \ share \ charsets/|
- + -------------------------- + ------------------------------------------------ +
- 7 rows in set (0.00 sec)
It is found that the property of the line mark is not utf8.
Modify the my. ini file and set
The following is a UTF-8 code snippet that sets all parameters for the MySQL character set:
- [Client]
- Default-character-set = utf8
- [MySQL (best combination with PHP)]
- Default-character-set = utf8
- [MySQL (the best combination with PHP) d]
- Default-character-set = utf8
-
Copy my. ini file to the windows directory
Start MySQL (the best combination of PHP and MySQL). The following code snippets are available:
- MySQL (best combination with PHP)> show variables like 'character _ set _ % ';
- + -------------------------- + ------------------------------------------------ +
- | Variable_name | Value |
- + -------------------------- + ------------------------------------------------ +
- | Character_set_client | utf8 |
- | Character_set_connection | utf8 |
- | Character_set_database | utf8 |
- | Character_set_results | utf8 |
- | Character_set_server | utf8 |
- | Character_set_system | utf8 |
- | Character_sets_dir | D: \ data \ MySQL (the best combination with PHP) Server 4.1 \ share \ charsets/|
- + -------------------------- + ------------------------------------------------ +
- 7 rows in set (0.00 sec)
- MySQL (best combination with PHP)> show variables like 'character _ set _ % ';
- + -------------------------- + ------------------------------------------------ +
- | Variable_name | Value |
- + -------------------------- + ------------------------------------------------ +
- | Character_set_client | utf8 |
- | Character_set_connection | utf8 |
- | Character_set_database | utf8 |
- | Character_set_results | utf8 |
- | Character_set_server | utf8 |
- | Character_set_system | utf8 |
- | Character_sets_dir | D: \ data \ MySQL (the best combination with PHP) Server 4.1 \ share \ charsets/|
- + -------------------------- + ------------------------------------------------ +
- 7 rows in set (0.00 sec)
Everything is normal.
Create a database:
The following is a code snippet:
- Create table t_sysuser (
- USERID integer not null auto_increment,
- USERNAME varchar (30 ),
- PASSWORDS varchar (30 ),
- DEPTNO varchar (30 ),
- HEADSHIP varchar (30 ),
- SEX varchar (4 ),
- TEL varchar (18 ),
- EMAIL varchar (30 ),
- URL varchar (30 ),
- PCALL varchar (20 ),
- USERPHOTO varchar (255 ),
- FACEREFUTIME integer,
- FACELANGUAGE varchar (1 ),
- LASTMODIF varchar (30 ),
- LASTMDATE datetime,
- CREADTOR varchar (30 ),
- CREATDATE datetime,
- Prima (the most comprehensive virtual host Management System) ry key (USERID)
- ) ENGINE = InnoDB default charset = utf8;
All done.
The above content is an introduction to setting all the parameters of the MySQL character set to UTF8. I hope you will have some gains.