通过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 character_set_system=utf8;
SHOW VARIABLES LIKE ‘character%‘;
java连接mysql在url加上?useUnicode=true&characterEncoding=utf-8
刷新缓存:
flush privileges;
时间: 2025-01-22 00:43:30