In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
MySQL character set Settings
System variable:
-character_set_server: default internal operation character set
-character_set_client: the character set used by the client source data
-character_set_connection: connection layer character set
-character_set_results: query result character set
-character_set_database: the default character set of the currently selected database
-character_set_system: system metadata (field name, etc.) character set
-there are also variables starting with collation_ that correspond to the above to describe the character order.
Log in to the MySQL database:
C:\ Users\ duansf > mysql-u root-p
Enter password: *
Welcome to the MySQL monitor. Commands end with; or\ g.
Your MySQL connection id is 4
Server version: 5.5.13 MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.
Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.
Mysql >
one。 View the character set of the MySQL database server and database MySQL:
Mysql > show variables like'% char%'
+-+
| | Variable_name | Value |
+-+
| | character_set_client | utf8 |
| | character_set_connection | utf8 |
| | character_set_database | gbk |
| | character_set_filesystem | binary |
| | character_set_results | utf8 |
| | character_set_server | utf8 |
| | character_set_system | utf8 |
| | character_sets_dir | C:\ Program Files (x86)\ MySQL\ MySQL Server 5.5\ share\ charsets\ | |
+-+
8 rows in set (0.00 sec)
two。 View the MySQL character set of the MySQL data Table (table):
Mysql > use test
Database changed
Mysql > show table status from test like'% work%'
+-+ +
-+-
-+
| | Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length |
Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collat
Ion | Checksum | Create_options | Comment |
+-+ +
-+-
-+
| | workinfo | InnoDB | 10 | Compact | 1 | 16384 | 16384 | 0 | |
32768 | 9437184 | 4 | 2016-03-07 16:13:51 | NULL | NULL | utf8_g
Eneral_ci | NULL |
+-+ +
-+-
-+
1 row in set (0.00 sec)
three。 View the MySQL character set of the MySQL data column (column):
Mysql > show full columns from workinfo
+-
-+
| | Field | Type | Collation | Null | Key | Default | Extra | Privileges |
| | Comment |
+-
-+
| | id | int (10) | NULL | NO | PRI | NULL | auto_increment | select,insert,u |
Pdate,references | |
| | name | varchar (20) | utf8_general_ci | NO | | NULL | | select,insert,u |
Pdate,references | |
| | type | varchar (10) | utf8_general_ci | YES | | NULL | | select,insert,u |
Pdate,references | |
| | address | varchar (50) | utf8_general_ci | YES | | NULL | | select,insert,u |
Pdate,references | |
| | tel | varchar (20) | utf8_general_ci | YES | | NULL | | select,insert,u |
Pdate,references | |
| | wages | int (11) | NULL | YES | | NULL | | select,insert,u |
Pdate,references | |
| | contents | tinytext | utf8_general_ci | YES | | NULL | | select,insert,u |
Pdate,references | |
| | extra | text | utf8_general_ci | YES | | NULL | | select,insert,u |
Pdate,references | |
+-
-+
8 rows in set (0.02 sec)
How to solve the mismatch of character set communication settings:
(modify the default character_set_client,character_set_connection,character_set_result)
1. Recompile mysql and php,mysql with the compilation parameter-default-character-set=utf8
2. The PHP program executes mysql_query ("set names utf8;") before querying the database
3. Modify my.cnf and add init-connect= "set names utf8" to [mysqld] (this option is not valid for super user connections)
4. Start mysqld join parameter-skip-character-set-client-handshake ignores client character set
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.