gpt4 book ai didi

mysql - 表 'performance_schema.session_variables' 不存在

转载 作者:行者123 更新时间:2023-12-02 15:33:45 25 4
gpt4 key购买 nike

我是使用 MySql 数据库的新手,我已经下载了 EasyPHP-Devserver-16.1,当我运行服务器来更新我的数据库架构时,会显示此错误消息。

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'performance_schema.session_variables' doesn't exist

我知道问题不在我的spring配置文件中,而是在mysql服务器中。

public class Configurations {

protected static final String PROPERTY_NAME_DATABASE_DRIVER = "com.mysql.jdbc.Driver";
protected static final String PROPERTY_NAME_DATABASE_PASSWORD = "";
protected static final String PROPERTY_NAME_DATABASE_URL = "jdbc:mysql://127.0.0.1:3306/quraa";
protected static final String PROPERTY_NAME_DATABASE_USERNAME = "root";

private static final String PROPERTY_PACKAGES_TO_SCAN = "com.med.quraa.models";
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean(DataSource dataSource, JpaVendorAdapter jpaVendorAdapter){
LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
entityManagerFactoryBean.setDataSource(dataSource);
entityManagerFactoryBean.setJpaVendorAdapter(jpaVendorAdapter);
entityManagerFactoryBean.setPackagesToScan(PROPERTY_PACKAGES_TO_SCAN);
return entityManagerFactoryBean;
}

@Bean
public DriverManagerDataSource dataSource(){
DriverManagerDataSource ds = new DriverManagerDataSource();
ds.setDriverClassName(PROPERTY_NAME_DATABASE_DRIVER);
ds.setUrl(PROPERTY_NAME_DATABASE_URL);
ds.setUsername(PROPERTY_NAME_DATABASE_USERNAME);
ds.setPassword(PROPERTY_NAME_DATABASE_PASSWORD);
return ds;
}

@Bean
public JdbcTemplate jdbcTemplate(){
JdbcTemplate jdbcTemplate=new JdbcTemplate();
jdbcTemplate.setDataSource(dataSource());
return jdbcTemplate;
}

@Bean
public JpaVendorAdapter jpaVendorAdapter(){
HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
adapter.setDatabase(Database.MYSQL);
adapter.setShowSql(true);
adapter.setGenerateDdl(true);
adapter.setDatabasePlatform("org.hibernate.dialect.MySQL5InnoDBDialect");
return adapter;
}

@Bean
public PlatformTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) {
return new JpaTransactionManager(entityManagerFactory);
}

}

请注意,我也测试了org.apache.tomcat.dbcp.dbcp.BasicDataSource,但我遇到了同样的错误,这意味着org.springframework.jdbc.datasource.DriverManagerDataSource 没问题

最佳答案

  1. 首先升级您的 MySql 服务器,通过运行以下命令解决问题:

    mysql_upgrade -u root -p --force

  2. 然后重新启动服务器:

关于mysql - 表 'performance_schema.session_variables' 不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36746677/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com