mysql5.7.20中文,ubuntu16.04 mysql5.7.20表中插入中文顯示???的解決方法
打開配置文件:sudo gedit /etc/mysql/my.cnf
在最下面添加:
[client]
default-character-set=utf8
[mysqld]
character-set-server=utf8
[mysql]
default-character-set=utf8
保存
暫停mysql服務:sudo /etc/init.d/mysql stop
重啟mysql服務:sudo /etc/init.d/mysql restart
登錄mysql:sudo mysql -u root -p
查看字符串編碼:show variables like '%char%';
如果結果顯示:
+--------------------------+----------------------------+
| Variable_name? ? ? ? ? ? | Value? ? ? ? ? ? ? ? ? ? ? |
+--------------------------+----------------------------+
| character_set_client? ? ?| utf8? ? ? ? ? ? ? ? ? ? ? ?|
| character_set_connection | utf8? ? ? ? ? ? ? ? ? ? ? ?|
| character_set_database? ?| utf8? ? ? ? ? ? ? ? ? ? ? ?|
| character_set_filesystem | binary? ? ? ? ? ? ? ? ? ? ?|
| character_set_results? ? | utf8? ? ? ? ? ? ? ? ? ? ? ?|
| character_set_server? ? ?| utf8? ? ? ? ? ? ? ? ? ? ? ?|
| character_set_system? ? ?| utf8? ? ? ? ? ? ? ? ? ? ? ?|
| character_sets_dir? ? ? ?| /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
則配置成功
總結
以上是生活随笔為你收集整理的mysql5.7.20中文,ubuntu16.04 mysql5.7.20表中插入中文顯示???的解決方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 妙招教你Office Word 2007
- 下一篇: mysql格式分隔符row_MySQLR