Error message:
Solution:
1. First add: &allowMultiQueries=true
after the database connection string
jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
2. If there is still error, add a file
@Configuration
public class DruidConfig {
@Bean
@ConfigurationProperties(prefix="spring.datasource")
public DataSource druidPrimary(){
DruidDataSource druidDataSource = new DruidDataSource();
List<Filter> filterList = new ArrayList<>();
filterList.add(wallFilter());
druidDataSource.setProxyFilters(filterList);
return new DruidDataSource();
}
@Bean
public WallFilter wallFilter(){
WallFilter wallFilter = new WallFilter();
wallFilter.setConfig(wallConfig());
return wallFilter;
}
@Bean
public WallConfig wallConfig() {
WallConfig config = new WallConfig();
config.setMultiStatementAllow(true);//允许一次执行多条语句
config.setNoneBaseStatementAllow(true);//允许一次执行多条语句
return config;
}
}