# Incorrect definition of table mysql.db

**URL:** <https://forums.percona.com/t/incorrect-definition-of-table-mysql-db/4185>\
**Category:** Percona XtraDB Cluster 5.x\
**Created:** [April 27, 2015, 3:52am UTC](https://forums.percona.com/t/incorrect-definition-of-table-mysql-db/4185 "2015-04-27T03:52:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![umarzuki](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/umarzuki/32/1064_2.png) [@umarzuki](https://forums.percona.com/u/umarzuki)\
**Post date:** [April 27, 2015, 3:52am UTC](https://forums.percona.com/t/incorrect-definition-of-table-mysql-db/4185/1 "2015-04-27T03:52:20Z")

</div>

I’m seing these messages on one my 2 nodes but there’s no binary logs on that node.

2015-04-27 16:49:07 11211 [ERROR] Incorrect definition of table mysql.db: expected column ‘User’ at position 2 to have type char(16), found type char(80).  
2015-04-27 16:49:07 11211 [ERROR] Incorrect definition of table mysql.event: expected column ‘definer’ at position 3 to have type char(77), found type char(141).  
2015-04-27 16:49:07 11211 [ERROR] Incorrect definition of table mysql.event: expected column ‘sql\_mode’ at position 14 to have type set(‘REAL\_AS\_FLOAT’,‘PIPES\_AS\_CONCAT’,‘ANSI\_QUOTES’,‘IGNORE\_SPACE’,‘NOT\_USED’,‘ONLY\_FULL\_GROUP\_BY’,‘NO\_UNSIGNED\_SUBTRACTION’,‘NO\_DIR\_IN\_CREATE’,‘POSTGRESQL’,‘ORACLE’,‘MSSQL’,‘DB2’,‘MAXDB’,‘NO\_KEY\_OPTIONS’,‘NO\_TABLE\_OPTIONS’,‘NO\_FIELD\_OPTIONS’,‘MYSQL323’,‘MYSQL40’,‘ANSI’,‘NO\_AUTO\_VALUE\_ON\_ZERO’,‘NO\_BACKSLASH\_ESCAPES’,‘STRICT\_TRANS\_TABLES’,‘STRICT\_ALL\_TABLES’,‘NO\_ZERO\_IN\_DATE’,‘NO\_ZERO\_DATE’,‘INVALID\_DATES’,‘ERROR\_FOR\_DIVISION\_BY\_ZERO’,‘TRADITIONAL’,‘NO\_AUTO\_CREATE\_USER’,‘HIGH\_NOT\_PRECEDENCE’,‘NO\_ENGINE\_SUBSTITUTION’,‘PAD\_CHAR\_TO\_FULL\_LENGTH’), found type set(‘REAL\_AS\_FLOAT’,‘PIPES\_AS\_CONCAT’,‘ANSI\_QUOTES’,‘IGNORE\_SPACE’,‘IGNORE\_BAD\_TABLE\_OPTIONS’,‘ONLY\_FULL\_GROUP\_BY’,‘NO\_UNSIGNED\_SUBTRACTION’,‘NO\_DIR\_IN\_CREATE’,‘POSTGRESQL’,‘ORACLE’,‘MSSQL’,‘DB2’,‘MAXDB’,‘NO\_KEY\_OPTIONS’,‘NO\_TABLE\_OPTIONS’,‘NO\_FIELD\_OPTIONS’,‘MYSQL323’,‘MYSQL40’,‘ANSI’,‘NO\_AUTO\_VALUE\_ON\_ZERO’,‘NO\_BACKSLASH\_ESCAPES’,‘STRICT\_TRANS\_TABLES’,'STRICT\_A  
2015-04-27 16:49:07 11211 [ERROR] Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.

My database was restored from mysqldump --all-database of MariaDB 10.0

percona-xtradb-cluster-5.6  
Version: 5.6.22-25.8-978.trusty

---

<div class="post-metadata">

**Author:** ![umarzuki](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/umarzuki/32/1064_2.png) [@umarzuki](https://forums.percona.com/u/umarzuki)\
**Post date:** [April 27, 2015, 4:02am UTC](https://forums.percona.com/t/incorrect-definition-of-table-mysql-db/4185/2 "2015-04-27T04:02:48Z")

</div>

when I tried to restore db & event table for database mysql (mysqldump from a percona xtradb cluster node with same version), below messages appeared on another node where restoration did not take place

2015-04-27 17:30:03 18831 [ERROR] Slave SQL: Error ‘Table ‘mysql.db’ doesn’t exist’ on query. Default database: ‘mysql’. Query: ‘/\*!40000 ALTER TABLE `db` DISABLE KEYS _/', Error\_code: 1146  
2015-04-27 17:30:03 18831 [Warning] WSREP: RBR event 1 Query apply warning: 1, 46360  
2015-04-27 17:30:03 18831 [Warning] WSREP: Ignoring error for TO isolated action: source: 8df5a19c-ecbc-11e4-9d1f-0be6ae4e1b84 version: 3 local: 0 state: APPLYING flags: 65 conn\_id: 2145 trx\_id: -1 seqnos (l: 2350, g: 46360, s: 46358, d: 46359, ts: 538828340331030)  
2015-04-27 17:30:03 18831 [ERROR] Slave SQL: Error ‘Table ‘mysql.db’ doesn’t exist’ on query. Default database: ‘mysql’. Query: '/_!40000 ALTER TABLE `db` ENABLE KEYS _/', Error\_code: 1146  
2015-04-27 17:30:03 18831 [Warning] WSREP: RBR event 1 Query apply warning: 1, 46361  
2015-04-27 17:30:03 18831 [Warning] WSREP: Ignoring error for TO isolated action: source: 8df5a19c-ecbc-11e4-9d1f-0be6ae4e1b84 version: 3 local: 0 state: APPLYING flags: 65 conn\_id: 2145 trx\_id: -1 seqnos (l: 2351, g: 46361, s: 46360, d: 46360, ts: 538828384858347)  
2015-04-27 17:30:10 18831 [ERROR] Slave SQL: Error ‘Table ‘mysql.event’ doesn’t exist’ on query. Default database: ‘mysql’. Query: '/_!40000 ALTER TABLE `event` DISABLE KEYS _/', Error\_code: 1146  
2015-04-27 17:30:10 18831 [Warning] WSREP: RBR event 1 Query apply warning: 1, 46370  
2015-04-27 17:30:10 18831 [Warning] WSREP: Ignoring error for TO isolated action: source: 8df5a19c-ecbc-11e4-9d1f-0be6ae4e1b84 version: 3 local: 0 state: APPLYING flags: 65 conn\_id: 2145 trx\_id: -1 seqnos (l: 2360, g: 46370, s: 46369, d: 46369, ts: 538835476300921)  
2015-04-27 17:30:10 18831 [ERROR] Slave SQL: Error ‘Table ‘mysql.event’ doesn’t exist’ on query. Default database: ‘mysql’. Query: '/_!40000 ALTER TABLE `event` ENABLE KEYS \*/’, Error\_code: 1146  
2015-04-27 17:30:10 18831 [Warning] WSREP: RBR event 1 Query apply warning: 1, 46371  
2015-04-27 17:30:10 18831 [Warning] WSREP: Ignoring error for TO isolated action: source: 8df5a19c-ecbc-11e4-9d1f-0be6ae4e1b84 version: 3 local: 0 state: APPLYING flags: 65 conn\_id: 2145 trx\_id: -1 seqnos (l: 2361, g: 46371, s: 46370, d: 46370, ts: 538835497820819)

---

<div class="post-metadata">

**Author:** ![wagnerbianchi](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/wagnerbianchi/32/802_2.png) [@wagnerbianchi](https://forums.percona.com/u/wagnerbianchi)\
**Post date:** [April 27, 2015, 2:54pm UTC](https://forums.percona.com/t/incorrect-definition-of-table-mysql-db/4185/3 "2015-04-27T14:54:54Z")

</div>

Make sure you’re always using the same version of Xtrabackup and XtraDB Cluster components.

1-) There are many differences between Percona Server and MariaDB and this is what the MySQL is now complaining about. Are you able to restore the db and event tables from another Percona Server? Take care about the data it contains…

2-) MySQL is complaining at the end that the tables db and event do not exists. Can you check on the file system if tables db and event files are there? Remember that all the mysql system database tables are MyISAM (3 files, frm, myi, myd).

Cheers,

---

<div class="post-metadata">

**Author:** ![umarzuki](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/umarzuki/32/1064_2.png) [@umarzuki](https://forums.percona.com/u/umarzuki)\
**Post date:** [April 27, 2015, 7:44pm UTC](https://forums.percona.com/t/incorrect-definition-of-table-mysql-db/4185/4 "2015-04-27T19:44:02Z")

</div>

1. post #2 are output during restore of mysql db table & mysql event table. Just realized it shutsdown after restoring those tables

2. on node 2

mysql\> show tables;  
±--------------------------+  
| Tables\_in\_mysql |  
±--------------------------+  
| audit\_log |  
| column\_stats |  
| columns\_priv |  
| func |  
| general\_log |  
| gtid\_slave\_pos |  
| help\_category |  
| help\_keyword |  
| help\_relation |  
| help\_topic |  
| host |  
| index\_stats |  
| innodb\_index\_stats |  
| innodb\_table\_stats |  
| ndb\_binlog\_index |  
| plugin |  
| proc |  
| procs\_priv |  
| proxies\_priv |  
| roles\_mapping |  
| servers |  
| slave\_master\_info |  
| slave\_relay\_log\_info |  
| slave\_worker\_info |  
| slow\_log |  
| table\_stats |  
| tables\_priv |  
| time\_zone |  
| time\_zone\_leap\_second |  
| time\_zone\_name |  
| time\_zone\_transition |  
| time\_zone\_transition\_type |  
| user |  
±--------------------------+

on node 1

mysql\> use mysql;  
ERROR 1047 (08S01): Unknown command

it seems on both nodes I installed percona-xtrabackup 2.2.10-1.trusty & percona-xtradb-cluster-galera-3.x 3.9.3494.trusty

---

<div class="post-metadata">

**Author:** ![umarzuki](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/umarzuki/32/1064_2.png) [@umarzuki](https://forums.percona.com/u/umarzuki)\
**Post date:** [April 27, 2015, 8:21pm UTC](https://forums.percona.com/t/incorrect-definition-of-table-mysql-db/4185/5 "2015-04-27T20:21:05Z")

</div>

after purged and re-installed of node 1, I bootstrap it, then let node 2 join the cluster, there’s no more db & event table not exist error.

FYI, I’m using rsync sst method.
