您的位置:首页 > 数据库 > MySQL

mysql乱码-解决方案

2010-07-09 11:46 99 查看
版本:
Server version: 5.1.40-community MySQL Community Server

客户端:Navicat 8.2 for MySQL

1.安装mysql数据库,字符集选择为:utf8。
2.安装完后,使用客户端连接到mysql数据库,同时在test数中建立表id。
3.在表id中输入信息(包含中文资料)
4.使用客户端浏览表id一切显示正常。
5.使用mysql控制台浏览表id中文信息显示为乱码。

解决方案:
在mysql的控制台,输入命令:
mysql> set names='utf8';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '' at
line 1
mysql>
mysql> set character_set_results=GBK;
Query OK, 0 rows affected (0.00 sec)
mysql>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息