Home >Database >Mysql Tutorial >MySQL5.0中文问题实际解决方案
以下的文章主要是对MySQL5.0中文问题的实际解决方案的描述,你如果对MySQL5.0中文问题的实际解决方案有兴趣的话你就可以点击以下的文章进行观看了。希望在你今后的学习中会有所帮助。 MySQL5.0中文问题的实际解决方案如下: 1.在dos环境下,用mysql --defaul
以下的文章主要是对 MySQL5.0中文问题的实际解决方案的描述,你如果对MySQL5.0中文问题的实际解决方案有兴趣的话你就可以点击以下的文章进行观看了。希望在你今后的学习中会有所帮助。
MySQL5.0中文问题的实际解决方案如下:
1.在dos环境下,用mysql --default-character-set=utf8 -u root -p 这句话进入mysql~~
2.mysql> show variables like 'character\_set\_%';
<ol class="dp-xml"> <li class="alt"><span><span>character_set_client utf8 </span></span></li> <li><span>character_set_connection utf8 </span></li> <li class="alt"><span>character_set_database utf8 </span></li> <li><span>character_set_results utf8 </span></li> <li class="alt"><span>character_set_server utf8 </span></li> <li><span>character_set_system utf8 </span></li> <li class="alt"> <span>mysql</span><span class="tag">></span><span> set </span><span class="attribute">character_set_results</span><span>=</span><span class="attribute-value">gbk</span><span>; </span> </li> <li> <span>mysql</span><span class="tag">></span><span> set </span><span class="attribute">character_set_client</span><span>=</span><span class="attribute-value">gbk</span><span>; </span> </li> <li class="alt"> <span>mysql</span><span class="tag">></span><span> show variables like 'character\_set\_%'; </span> </li> <li><span>character_set_client gbk </span></li> <li class="alt"><span>character_set_connection utf8 </span></li> <li><span>character_set_database utf8 </span></li> <li class="alt"><span>character_set_results gbk </span></li> <li><span>character_set_server utf8 </span></li> <li class="alt"><span>character_set_system utf8 </span></li> </ol>
3.MySQL5.0中文问题解决方案要建数据库、表,如下:
<ol class="dp-xml"> <li class="alt"><span><span>mysql</span><span class="tag">></span><span>create database demo; </span></span></li> <li> <span>mysql</span><span class="tag">></span><span>use demo; </span> </li> <li class="alt"> <span>mysql</span><span class="tag">></span><span>create table user ( id int(11) not null auto_increment primary key, </span> </li> <li> <span>name varchar(100) not Null , age int)</span><span class="attribute">type</span><span>=</span><span class="attribute-value">MyISAM</span><span>,default character set utf8; </span> </li> <li class="alt"><span>insert into user(name,age) values('本职工作',19); </span></li> <li><span>insert into user(name,age) values('张工作',22); </span></li> <li class="alt"><span>insert into user(name,age) values('王作',29); </span></li> </ol>
以上的相关内容就是对MySQL5.0中文问题解决方案的介绍,望你能有所收获。