In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the "how to solve the mysql character set set character_set_client=binary in the case of gbk table description is garbled" related knowledge, in the actual case of the operation process, many people will encounter such a dilemma, and then let the editor lead you to learn how to deal with these situations! I hope you can read it carefully and be able to achieve something!
After the mysql link is established, set the encoding as follows:
The copy code is as follows:
Mysql_query ("SET character_set_connection=". $GLOBALS ['charset']. "character_set_results=". $GLOBALS ['charset']. ", character_set_client=binary", $this- > link)
However, the table structure description is garbled:
The copy code is as follows:
Mysql > show create table nw_admin_config\ G
* * 1. Row *
Table: nw_admin_config
Create Table: CREATE TABLE `nw_admin_ config` (
`name`varchar (30) NOT NULL DEFAULT''COMMENT''
`namespace` varchar (15) NOT NULL DEFAULT 'global' COMMENT' roommates'
`value`value` text COMMENT 'please give me some money.
`vtype` enum ('string','array','object') NOT NULL DEFAULT' string' COMMENT 'has a lot of money to do.
`mistress' text COMMENT'in the middle of the year
PRIMARY KEY (`namespace`, `name`)
) ENGINE=MyISAM DEFAULT CHARSET=gbk COMMENT=' please do not know what to do.
After investigation, it was found that character_set_client=binary was to blame:
The copy code is as follows:
$targetDb- > query ("SET NAMES'{$charset}'")
The copy code is as follows:
Mysql > show create table nw_admin_config\ G
* * 1. Row *
Table: nw_admin_config
Create Table: CREATE TABLE `nw_admin_ config` (
`name`varchar (30) NOT NULL DEFAULT''COMMENT' configuration name'
`namespace`varchar (15) NOT NULL DEFAULT 'global' COMMENT' configure namespace'
`value`text COMMENT 'cache value'
`vtype`enum ('string','array','object') NOT NULL DEFAULT' string' COMMENT 'configuration value Type'
`introduction`text COMMENT 'configuration introduction'
PRIMARY KEY (`namespace`, `name`)
) ENGINE=MyISAM DEFAULT CHARSET=gbk COMMENT=' site configuration table'
However, if the character set I set is UTF8 and the table structure is utf8, then even if I use the above character_set_client=binary, the table structure description is normal:
The copy code is as follows:
Mysql > show create table nw_admin_config\ G
* * 1. Row *
Table: nw_admin_config
Create Table: CREATE TABLE `nw_admin_ config` (
`name`varchar (30) NOT NULL DEFAULT''COMMENT' configuration name'
`namespace`varchar (15) NOT NULL DEFAULT 'global' COMMENT' configure namespace'
`value`text COMMENT 'cache value'
`vtype`enum ('string','array','object') NOT NULL DEFAULT' string' COMMENT 'configuration value Type'
`introduction`text COMMENT 'configuration introduction'
PRIMARY KEY (`namespace`, `name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT=' site configuration table'
The strange thing is that garbled exists only in the description in the table structure, but it is normal for the inserted data in Chinese.
Character_set_client=binary on the Internet said that "most of them are set up to solve the problem of garbled code", but I don't know that the description of the table structure is garbled instead. What exactly is the function of this? Why is the structure of the table different?
This is the end of the content of "how to solve the problem that the table description is garbled when the mysql character set is set up character_set_client=binary in the case of gbk". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.