1.打开cmd窗口
2.执行命令行 mysql -u root -p
如图出现下面界面
3.查看mysql全局编码格式 输入下面
show variables like 'character%';
4.把mysql的全局编码格式修改为utf8(character_set_filesystem=binary 不用修改)
mysql> set character_set_client = utf8;
Query OK, 0 rows affected (0.04 sec)
mysql> set character_set_connection = utf8;
Query OK, 0 rows affected (0.00 sec)
mysql> set character_set_database = utf8;
Query OK, 0 rows affected (0.00 sec)
mysql> set character_set_filesystem = utf8;
Query OK, 0 rows affected (0.00 sec)
mysql> set character_set_results = utf8;
Query OK, 0 rows affected (0.00 sec)
mysql> set character_set_server = utf8;
Query OK, 0 rows affected (0.00 sec)
5.查看修改后的mysql全局编码格式
show variables like 'character%';
6.修改某个数据库实例的编码:
6.1.选择数据库实例
mysql> use mysql;
Database changed
6.2.查看数据库实例信息;执行 status;
mysql> status;
7.修改数据库编码;
set names 'utf8';
8.查看修改编码格式后的数据库信息;执行 status;
mysql> status;