mysql5.7 error analysis 1546,1577 and 1682 issues

Environment Description:
Data xtrabackup full backup on MySQL5.6.40 into the mysql5.7.24 instance, start MySQL5.7 service, log database MySQL5.7 instance. However, when the drop user user@'127.0.0.1 ', given as follows:

2019-08-15T19:02:31.160910+08:00 1546 [ERROR] /usr/local/mysql5.7/bin/mysqld: Column count of mysql.user is wrong. Expected 45, found 43. Created with MySQL 50640, now running 50724. Please use mysql_upgrade to fix this error.

mysql instance version is as follows:

[root@e ~]# /usr/local/mysql/bin/mysqld -V
/usr/local/mysql/bin/mysqld  Ver 5.6.40 for Linux on x86_64 (Source distribution)
[root@e ~]# /usr/local/mysql5.7/bin/mysqld -V
/usr/local/mysql5.7/bin/mysqld  Ver 5.7.24 for linux-glibc2.12 on x86_64 (MySQL Community Server (GPL))

Solution: Upgrading MySQL5.7


/usr/local/mysql5.7/bin/mysql_upgrade -uroot -p'ln.orge#dieurw5199' -S /tmp/3306.sock
Checking if update is needed.
Checking server version.
Running queries to upgrade MySQL server.
Checking system database.

testdb29.dtr_wx_gotourl                             OK
testdb29.dtr_zone                                   OK
testdb29.hm_planstats_h                            OK
Upgrade process completed successfully.
Checking if update is needed.

Login MySQL5.7 delete user libraries, deleted successfully

mysql> drop user backupuser@'127.0.0.1';
Query OK, 0 rows affected (0.00 sec)

Tip: At this point mysql5.7.24 instance and did not restart

Now when you create a timer to call a stored procedure, given as follows:

mysql> CREATE EVENT test1
    -> ON SCHEDULE EVERY 2 second STARTS TIMESTAMP '2019-08-10 16:16:22'
    -> ON COMPLETION PRESERVE
    -> DO
    -> BEGIN
    -> CALL test1();
    -> END//

ERROR 1577 (HY000): Cannot proceed because system tables used by Event Scheduler were found damaged at server start
mysql> show events;
ERROR 1577 (HY000): Cannot proceed because system tables used by Event Scheduler were found damaged at server start

### tips can not continue because the system found table event scheduler used in the server startup is corrupt

At the moment View mysql system variables given as follows:

mysql> show variables like 'event_scheduler';
ERROR 1682 (HY000): Native table 'performance_schema'.'session_variables' has the wrong structure

The reason is that I upgraded version of mysql, but does not restart mysql instance
need to restart MySQL5.7.24 service. Otherwise it will lead to less than MySQL table to identify the parts of the system.

service restart mysql5.7.24

Here the issue is resolved

mysql> show events;
Empty set (0.00 sec)

mysql> show variables like 'event_scheduler';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| event_scheduler | ON    |
+-----------------+-------+
1 row in set (0.01 sec)

The newly created timer, execute successfully:

mysql> CREATE PROCEDURE test1() 
    -> BEGIN
    -> INSERT INTO tb01(username,password,create_time) values('李四', '张三',now());
    -> END//
Query OK, 0 rows affected (0.01 sec)

mysql> CREATE EVENT test1
    -> ON SCHEDULE EVERY 5 second STARTS TIMESTAMP '2019-08-16 17:34:22'
    -> ON COMPLETION PRESERVE
    -> DO
    -> BEGIN
    -> CALL test1();
    -> END//
Query OK, 0 rows affected (0.00 sec)

mysql> delimiter ; 
mysql> select now();

Guess you like

Origin blog.51cto.com/wujianwei/2430245