当前位置:Gxlcms > 数据库问题 > Ubuntu下mysql5.6解决不支持中文的办法

Ubuntu下mysql5.6解决不支持中文的办法

时间:2021-07-01 10:21:17 帮助过:4人阅读

    在[mysql]的下方加入如下语句:

    no-auto-rehash
    default-character-set=utf8

   /etc/mysql/mysql.conf.d/mysqld.cnf

    在[mysqld]下加入

    socket        = /var/run/mysqld/mysqld.sock
    port        = 3306
    character-set-server=utf8 等内容,自行对比,有的就不用加了,一般只需要加入 character-set-server=utf8

这时候shell 进入mysql,执行:show variables like ‘character%‘ , 结果如图:

技术分享

重启mysql: sudo /etc/init.d/mysql restart

Error Code: 1366. Incorrect string value: ‘\xE5\xBC\xA0\xE4\xB8\x89‘ for column ‘ename‘ at row 1

这是因为该表的字符集不支持中文所致,执行show create table  new_table 查看建表语句可知

解决办法:将该表删除,新建


Ubuntu下mysql5.6解决不支持中文的办法

标签:

人气教程排行