您的位置:首页 > 博客中心 > 数据库 >

修改mysql默认字符集的方法

时间:2022-03-15 05:27

修改mysql默认字符集的方法

1 最简单的修改方法,就是修改mysql的my.ini文件中的字符集键值,

如 default-character-set = utf8
    character_set_server = utf8  (注意中间没有-)

 修改完后,重启mysql的服务,service mysql restart

 

查看数据库编码:

 mysql> SHOW VARIABLES LIKE ‘character%‘;

 

2 还有一种修改mysql默认字符集的方法,就是使用mysql的命令

mysql> SET character_set_client = utf8 ;
mysql> SET character_set_connection = utf8 ;
mysql> SET character_set_database = utf8 ;
mysql> SET character_set_results = utf8 ;
mysql> SET character_set_server = utf8 ;

mysql> SET collation_connection = utf8 ;
mysql> SET collation_database = utf8 ;
mysql> SET collation_server = utf8 ;

 

修改mysql默认字符集的方法,布布扣,bubuko.com

热门排行

今日推荐

热门手游