Table ‘performance_schema.session_variables‘ doesn‘t exist

前言

因为升级mysql导致结构错误
版本由5.6升级到5.7的时候发现报错

解决办法

关闭mysql服务

service mysqld stop

修改/etc/my.cnf

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html

 
[mysqld]
server-id = 1
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp

#开启mysql binlog功能
log-bin=mysql-bin
##binlog记录内容的方式,记录被操作的每一行
binlog_format = ROW

socket=/var/lib/mysql/mysql.sock
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid



# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# socket = .....

# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 

重启mysql

service mysqld restart

继续输入

mysql_upgrade -u root -p你的密碼 --force

然后再重启即可。

你可能感兴趣的:(MySQL)