MySQL 表“performance_schema.session_variables”不存在

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36746677/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 21:44:34  来源:igfitidea点击:

Table 'performance_schema.session_variables' doesn't exist

mysqlspringmysql-error-1064

提问by Mohamed Nabli

I m new at using MySql data base, i have downloaded EasyPHP-Devserver-16.1, when I run my server to update my data base schema this error message shows up.

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

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

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 表 'performance_schema.session_variables' 不存在

I know that the problem is not in my spring configuration file but in mysql server.

我知道问题不在我的 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);
    }

}

Note that I have tested org.apache.tomcat.dbcp.dbcp.BasicDataSourcealso but I had the same error, that means that org.springframework.jdbc.datasource.DriverManagerDataSourcehave no problem with that

请注意,我也进行了测试,org.apache.tomcat.dbcp.dbcp.BasicDataSource但出现了相同的错误,这意味着org.springframework.jdbc.datasource.DriverManagerDataSource没有问题

回答by Rafik BELDI

  1. First upgrade your MySqlServer to solve the issue by running this command:

    mysql_upgrade -u root -p --force

  2. Then restartthe server:

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

    mysql_upgrade -u root -p --force

  2. 然后重启服务器:

回答by Mohamed Nabli

Solved... I opened cmd then :

解决了...然后我打开了 cmd :

cd [installation_path]\eds-binaries\dbserver\mysql5711x86x160420141510\bin

then executed this command line :

然后执行此命令行:

mysql_upgrade -u root -p --force

A server Restart is needed!

需要重启服务器!

回答by Md. Kawsaruzzaman

Here's how to fix it (from the command line):

这是修复它的方法(从命令行):

mysql -u {user} -p
mysql> set @@global.show_compatibility_56=ON;

In /etc/my.cnf:

在 /etc/my.cnf 中:

show_compatibility_56 = 1

this one really works for me without upgrading mysql. After this you need to restart mysql.

这个真的对我有用,而无需升级 mysql。在此之后,您需要重新启动 mysql。

回答by Pavel Zimogorov

Performance schema is not installed by default.
For checking, you can run the command

默认情况下不安装性能架构。
为了检查,您可以运行命令

SHOW VARIABLES LIKE 'performance_schema';

Suppose, now you will see OFF

假设,现在你会看到 OFF

To enable it, start the server with the performance_schema variable enabled. For example, use these lines in your my.cnf file:

要启用它,请在启用 performance_schema 变量的情况下启动服务器。例如,在 my.cnf 文件中使用这些行:

[mysqld]
performance_schema=ON

More details you can found in official documentation:

您可以在官方文档中找到更多详细信息:

https://dev.mysql.com/doc/refman/en/performance-schema-quick-start.html

https://dev.mysql.com/doc/refman/en/performance-schema-quick-start.html

回答by AAEM

As some people asked about the part of the server restart, i will post my answer considering that part:

当有人问到服务器重启的部分时,我将考虑到该部分发布我的答案:

1 .Go to the directory of the MySQL installation folder in my case it was: C:\Program Files\MySQL\MySQL Server 5.7\bin.

1 .转到 MySQL 安装文件夹的目录,在我的情况下是:C:\Program Files\MySQL\MySQL Server 5.7\bin。

  1. Open CMD in this directory, then Run "mysql_upgrade -u root -p" command.

  2. If your schema was protected by a password, you should enter the password when it is requested.

  3. This will make checking of all tables of all schema, so you should wait until the checking is finished.

  4. At the end the following message should appear:

  1. 在该目录下打开CMD,然后运行“mysql_upgrade -u root -p”命令。

  2. 如果您的架构受密码保护,则应在请求时输入密码。

  3. 这将检查所有模式的所有表,因此您应该等到检查完成。

  4. 最后应出现以下消息:

Upgrade process completed successfully.

Checking if update is needed.
Upgrade process completed successfully.

Checking if update is needed.
  1. Restart the MySQL server and router services:
  1. 重启 MySQL 服务器和路由器服务:
open task manager-->services-->right click on the services MySQL 
server and MySQL router-->restart them.
open task manager-->services-->right click on the services MySQL 
server and MySQL router-->restart them.
  1. Connect to your server using your workbench, it should connect.
  1. 使用您的工作台连接到您的服务器,它应该会连接。