jdbc连接Mysql数据库乱码解决方法

1.查看数据库编码格式:
show variables like 'character%';

2.设置连接编码格式:
jdbc:mysql://127.0.0.1:3306/databaseName? useUnicode=true&characterEncoding=gbk&zeroDateTimeBehavior=convertToNull
3.修改数据库编码格式:
SET character_set_client = gbk;
SET character_set_connection = gbk;
SET character_set_database = gbk;
SET character_set_results = gbk;
SET character_set_server = gbk;

你可能感兴趣的:(java,mysql,jdbc)