linux下mysql修改字符集

# 编辑/etc/my.cnf
vim /etc/my.cnf

# 在[mysqld]标签下添加下面内容
default-storage-engine = innodb
innodb_file_per_table
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8

# 编辑/etc/my.cnf.d/client.cnf
vim /etc/my.cnf.d/client.cnf

# 在[client]标签下添加下面内容
default-character-set=utf8

# 编辑/etc/my.cnf.d/mysql-clients.cnf
vim /etc/my.cnf.d/mysql-clients.cnf

# 在[mysql]标签下添加下面内容
default-character-set=utf8

说明:

    已建的库和表,编码不会改变。如果在已有库中继续建表,表依然会继承来自库的过去使用的编码
    编码解释:
    character_set_client为客户端编码方式;
    character_set_connection为建立连接使用的编码;character_set_database数据库的编码;
    character_set_results结果集的编码;
    character_set_server数据库服务器的编码;
  


show variables like 'character%';

猜你喜欢

转载自www.cnblogs.com/changefl/p/10791258.html