Home > Database > Mysql Tutorial > MySQL5.0中文问题的实际解决方案

MySQL5.0中文问题的实际解决方案

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 16:11:50
Original
1082 people have browsed it

以下的文章主要介绍的是MySQL5.0中文问题的实际解决方案。我们是在dos 环境之下对其进行操作,如果你对MySQL5.0中文问题相关的实际操作有兴趣的话,你就可以对以下的文章点击观看了。 1.在dos环境下,用mysql --default-character-set=utf8 -u root -p 这句

以下的文章主要介绍的是 MySQL5.0中文问题的实际解决方案。我们是在dos 环境之下对其进行操作,如果你对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>
Copy after login

3.建数据库、表,如下:
 

<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>
Copy after login


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template