Flask migration database reports 1146 "Table'performance_schema.session_variables' doesn't exist"

报 1146 "Table 'performance_schema.session_variables' doesn't exist" 原因:
MySQL 5.5新增一个存储引擎:命名PERFORMANCE_SCHEMA ,主要用于收集数据库服务器性能参数。MySQL用户是不能创建存储引擎为PERFORMANCE_SCHEMA的表

performance_schema提供以下功能:
1.提供进程等待的详细信息,包括锁、互斥变量、文件信息;
2.保存历史的事件汇总信息,为提供MySQL服务器性能做出详细的判断;
3.对于新增和删除监控事件点都非常容易,并可以随意改变mysql服务器的监控周期,例如(CYCLE、MICROSECOND)

通过以上得到的信息,DBA能够较明细得了解性能降低可能是由于哪些瓶颈?

performance_schema功能开启和部分表功能

Performance的开启很简单,在my.cnf中[mysqld]加入performanc_schema,检查性能数据库是否启动的命令:

SHOW VARIABLES LIKE ‘performance_schema’;

若是返回的 值为ON,则说明性能数据库正常开启状态。
 

Solution:
1. Enter the bin folder of the Mysql installation directory
2. Open cmd to enter the directory and execute the mysql_upgrade -u root -p --force command and enter the password to solve the problem


After performing the above operations, the problem should be resolved, but after solving the above errors, the following error may occur:
 (pymysql.err.OperationalError) (1682, "Native table'performance_schema'.'session_variables' has the wrong structure")
[ SQL: SHOW VARIABLES LIKE'sql_mode']

Solution:

mysql> set @@global.show_compatibility_56=ON;
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like '%data%';
+---------------------------------------+---------------------------------------------+
| Variable_name                         | Value                                       |
+---------------------------------------+---------------------------------------------+
| character_set_database                | utf8                                        |
| collation_database                    | utf8_general_ci                             |
| datadir                               | C:\ProgramData\MySQL\MySQL Server 5.7\Data\ |
| innodb_data_file_path                 | ibdata1:12M:autoextend                      |
| innodb_data_home_dir                  |                                             |
| innodb_stats_on_metadata              | OFF                                         |
| innodb_temp_data_file_path            | ibtmp1:12M:autoextend                       |
| max_length_for_sort_data              | 1024                                        |
| metadata_locks_cache_size             | 1024                                        |
| metadata_locks_hash_instances         | 8                                           |
| myisam_data_pointer_size              | 6                                           |
| performance_schema_max_metadata_locks | -1                                          |
| skip_show_database                    | OFF                                         |
| updatable_views_with_limit            | YES                                         |
+---------------------------------------+---------------------------------------------+
14 rows in set (0.00 sec)

 

 

Guess you like

Origin blog.csdn.net/haohao_ding/article/details/108587585