修改MySQL编码:

二话不说先登录:

mysql -u root -p

查看下神奇的mysql系统变量及其值:

show variables like '%character%';

//记住分号哦,爱打字的人

 Linux_CentOS-服务器搭建

步骤开始了:

1.找到mysql配置文件,拷贝到etc的my.cnf 并且覆盖哦。

/usr/share/doc/mysql-server-5.1.69/my-large.cnf 复制到 /etc/my.cnf

shell如下:

cp /usr/share/doc/mysql-server-5.1.69/my-large.cnf  /etc/my.cnf

2.打开 my.cnf 并设置编码

    //在[client]下增加
    default-character-set=utf8

  //在[mysqld]下增加
    default-character-set=utf8

  init_connect='set names utf8'

 

Linux_CentOS-服务器搭建

3.重启mysql  

service mysqld restart

 

再进行1的操作看看吧。

 

然后注意一小点的事情是:创建表格的时候:

create database test default character set utf8;

 

点个小  赞 

相关文章:

  • 2021-08-30
  • 2021-04-13
  • 2021-08-09
  • 2022-12-23
  • 2021-09-08
  • 2021-10-26
  • 2021-04-23
猜你喜欢
  • 2021-07-23
  • 2021-11-26
  • 2022-03-10
  • 2022-01-27
  • 2021-06-03
  • 2021-08-28
相关资源
相似解决方案