标签:nbsp variables end div ash centos names start event
问题描述:当我们在linux系统上装载mysql后操作数据库的时候,会出现中文乱码问题,比如做插入操作,发现添加到数据库的数据中文出现论码,下面就将解决linux下mysql中文乱码问题!:
环境centos6.5
1.打开Linux窗口,启动mysql:
mysql -uroot -proot
2.连接mysql后输入:
show variables like ‘%char%‘;
3.配置/etc/my.cnf如下(如果/etc/my.cnf不存在,可以新建/etc/my.cnf文件):
[client] default-character-set=utf8 [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 #default-character-set=utf8 character-set-server=utf8 init_connect=‘SET NAMES utf8‘ [mysql] no-auto-rehash default-character-set=utf8 [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid
4.重启mysql
service mysql stop;
service mysql status;
service mysql start;
5.连接mysql,输入:
show variables like ‘%char%‘;
则表示mysql中文乱码已解决。
标签:nbsp variables end div ash centos names start event
原文地址:https://www.cnblogs.com/coding2018/p/9460252.html