ihaokun

 

云服务器环境:CentOS 7.4

因为服务器配置较低,故使用MySQL5.5

 

未进行设置前

 

1、查看字符编码:

 

 

mysql> show variables like \'%character%\';

mysql> show variables like \'character_set_%\';

结果:

 

2、对应修改

2.1可通过命令行设置:

set character_set_client = utf8;

set character_set_server = utf8;

set character_set_connection = utf8;

set character_set_database = utf8;

set character_set_results = utf8;

set collation_connection = utf8_general_ci;

set collation_database = utf8_general_ci;

set collation_server = utf8_general_ci;

 

修改后:

 2.2,也可通过修改 my.cnf 文件来修改 utf8 编码

  这过程网上教程很多,在这附上一个参考博客地址:

  https://blog.csdn.net/u010005180/article/details/53468636

3、最后,重启mysql服务

注意,如果使用命令  service mysql restart

,则会报  Redirecting to /bin/systemctl restart mysql.service

 

故使用命令  systemctl restart mysql  来重启服务

查看 mysql 服务状态,同样,可用 systemctl status mysql 来查看

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-10-07
  • 2021-11-28
  • 2021-05-19
  • 2021-10-25
  • 2021-06-05
  • 2021-12-24
  • 2021-11-28
猜你喜欢
  • 2021-11-20
  • 2022-02-08
  • 2021-07-29
  • 2021-12-25
  • 2022-12-23
  • 2021-06-10
相关资源
相似解决方案