时间:2021-07-01 10:21:17 帮助过:2人阅读
root@b-ThinkPad-X230s:/usr/local/mysql/bin# ./mysqld_safe --user=root
151218 16:12:23 mysqld_safe Logging to ‘/usr/local/mysql/var/b-ThinkPad-X230s.err‘.
151218 16:12:23 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
再执行上面的查询命令:
mysql> show variables like ‘%character%‘;
+-----------------------------------+----------------------------------------+
| Variable_name | Value |
+----------------------------------+--------------------------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mysql/share/mysql/charsets/ |
+------------------------------------+----------------------------------------------+
8 rows in set (0.01 sec)
发现变化了的有:
character_set_database
character_set_server
还有几个没有变,接着改:
character_set_client;character_set_connection;character_set_results
按照网上的教程:
注意:如果此标签下已经存在“default-character-set=GBK”类似的内容,只需修改即可。
--在 [mysql] 标签下加上一行
default-character-set = utf8
--在 [mysql.server]标签下加上一行
default-character-set = utf8
--在 [mysqld_safe]标签下加上一行
default-character-set = utf8
--在 [client]标签下加上一行
default-character-set = utf8
我的my.cnf没有那么多区域,比如:[mysqld_safe][mysql.server] 这些我后来手动添加!
添加完成,然后重启,登录,检查:
结果不尽人意!
mysql> SHOW VARIABLES LIKE ‘%CHARACTER%‘;
+--------------------------+----------------------------------------+
| Variable_name | Value |
+--------------------------+----------------------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mysql/share/mysql/charsets/ |
+--------------------------+----------------------------------------+
8 rows in set (0.00 sec)
索性把刚才的操作删除!
关于mysql中数据库编码的问题
标签: