设置MySQL编码方式

  • 查看编码格式
    SHOW VARIABLES LIKE 'character_set_%';

    设置MySQL编码方式_第1张图片
    character_set_

  • 依次设置编码格式

set character_set_client = utf8;
set character_set_connection = utf8;
set character_set_database = utf8;
set character_set_filesystem = utf8;
set character_set_results = utf8;
set character_set_server = utf8;
set collation_connection = utf8_general_ci;
set collation_database = utf8_general_ci;
  • 设置my.cnf配置文件
character-set-server=utf8
default-character-set=utf8
  • 重启mysqld 使配置生效
    sudo service mysqld restart

你可能感兴趣的:(设置MySQL编码方式)