Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Table 'performance_schema.session_variables' doesn't exist

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.

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

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

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.BasicDataSource also but I had the same error, that means that org.springframework.jdbc.datasource.DriverManagerDataSource have no problem with that

like image 272
Mohamed Nabli Avatar asked Apr 20 '16 14:04

Mohamed Nabli


3 Answers

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

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

[mysqld]
performance_schema=ON

More details you can found in official documentation:

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

like image 169
Pavel Zimogorov Avatar answered Oct 30 '22 19:10

Pavel Zimogorov


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

    mysql_upgrade -u root -p --force

  2. Then restart the server:

like image 26
Rafik BELDI Avatar answered Oct 30 '22 19:10

Rafik BELDI


Solved... I opened cmd then :

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

then executed this command line :

mysql_upgrade -u root -p --force

A server Restart is needed!

like image 27
Mohamed Nabli Avatar answered Oct 30 '22 17:10

Mohamed Nabli