Ubuntu中MySQL5.7设置utf8编码格式步骤

  • vim /etc/mysql/mysql.conf.d

    lc-messages-dir = /usr/share/mysql 语句后添加 character-set-server=utf8

  • vim /etc/mysql/conf.d/mysql.cnf

    添加default-character-set=utf8

  • /etc/init.d/mysql restart