mysql的字符集统一设置问题
最近做了一个项目,过程中发生了数据库乱码,从phpmyadmin中怎么设置不知道。我去啊!!想了想肯定是字符集设置不一致,php编码是对了,并且都是采用utf-8的字符集设置的,所以肯定是mysql字符集设置的问题。又用phpmyadmin设置了半天还是不行。奶奶的,索性不用phpmyadmin了,真费劲!!
直接打开了mysql的控制台,哈哈弄好了,希望下边的操作对你们有帮助,记得回哦,大家一起进步!!!
一、查看 MySQL 数据库服务器和数据库字符集。
mysql> show variables like '%char%';
+--------------------------+-------------------------------------+------
| Variable_name | Value |......
+--------------------------+-------------------------------------+------
| character_set_client | utf8 |...... -- 客户端字符集
| character_set_connection | utf8 |......
| character_set_database | utf8 |...... -- 数据库字符集
| character_set_filesystem | binary |......
| character_set_results | utf8 |......
| character_set_server | utf8 |...... -- 服务器字符集
| character_set_system | utf8 |......
| character_sets_dir | D:\MySQL Server 5.0\share\charsets\ |......
+--------------------------+-------------------------------------+------
二、查看 MySQL 数据表(table) 的字符集。
mysql> show table status from sqlstudy_db like '%countries%';
+-----------+--------+---------+------------+------+-----------------+------
| Name | Engine | Version | Row_format | Rows | Collation |......
+-----------+--------+---------+------------+------+-----------------+------
| countries | InnoDB | 10 | Compact | 11 | utf8_general_ci |......
+-----------+--------+---------+------------+------+-----------------+------
三、查看 MySQL 数据列(column)的字符集。
mysql> show full columns from countries;
+----------------------+-------------+-----------------+--------
| Field | Type | Collation
相关新闻>>
- 发表评论
-
- 最新评论 更多>>