diff --git a/paicoding-web/src/main/java/com/github/paicoding/forum/web/config/init/ForumDataSourceInitializer.java b/paicoding-web/src/main/java/com/github/paicoding/forum/web/config/init/ForumDataSourceInitializer.java index 92b114f4328d3c78755dc65b995ddf0375934e51..0893999ef9d23ad863b349ad3c7d9e4dbef0c1e5 100644 --- a/paicoding-web/src/main/java/com/github/paicoding/forum/web/config/init/ForumDataSourceInitializer.java +++ b/paicoding-web/src/main/java/com/github/paicoding/forum/web/config/init/ForumDataSourceInitializer.java @@ -82,7 +82,7 @@ public class ForumDataSourceInitializer { ResultSet set = statement.executeQuery("select schema_name from information_schema.schemata where schema_name = '" + database + "'"); if (!set.next()) { // 不存在时,创建数据库 - String createDb = "CREATE DATABASE IF NOT EXISTS " + database; + String createDb = "CREATE DATABASE IF NOT EXISTS " + database +" CHARACTER SET UTF8"; connection.setAutoCommit(false); statement.execute(createDb); connection.commit();