1. 程式人生 > 實用技巧 >ERROR 1146 (42S02): Table 'mysql.servers' doesn't exist

ERROR 1146 (42S02): Table 'mysql.servers' doesn't exist

修改使用者許可權,重新整理許可權表,報1146

mysql> flush privileges;

ERROR 1146 (42S02): Table 'mysql.servers' doesn't exist

mysql> use mysql;

mysql> show tables;可以看到servers表,在系統mysql 目錄下,可以看到server.ibd 和server.frm,可知表定義為innodb表。

mysql> drop table if exists servers;
Query OK, 0 rows affected, 1 warning (0.01 sec)

mysql> show warnings;
+---------+------+-------------------------------------+
| Level | Code | Message |
+---------+------+-------------------------------------+
| Warning | 1146 | Table 
'mysql.servers' doesn't exist | +---------+------+-------------------------------------+ 1 row in set (0.00 sec) mysql>CREATE TABLE `servers` ( `Server_name` char(64) NOT NULL DEFAULT '', `Host` char(64) NOT NULL DEFAULT '', `Db` char(64) NOT NULL DEFAULT '', `Username` char(64) NOT NULL DEFAULT ''
, `Password` char(64) NOT NULL DEFAULT '', `Port` int(4) NOT NULL DEFAULT '0', `Socket` char(64) NOT NULL DEFAULT '', `Wrapper` char(64) NOT NULL DEFAULT '', `Owner` char(64) NOT NULL DEFAULT '', PRIMARY KEY (`Server_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='MySQL Foreign Servers table
' ERROR 1146 (42S02): Table 'mysql.servers' doesn't exist mysql> CREATE TABLE `servers` ( -> `Server_name` char(64) NOT NULL, -> `Host` char(64) NOT NULL, -> `Db` char(64) NOT NULL, -> `Username` char(64) NOT NULL, -> `Password` char(64) NOT NULL, -> `Port` int(4) DEFAULT NULL, -> `Socket` char(64) DEFAULT NULL, -> `Wrapper` char(64) NOT NULL, -> `Owner` char(64) NOT NULL, -> PRIMARY KEY (`Server_name`) -> ) ENGINE=MyISAM DEFAULT CHARSET=utf8; Query OK, 0 rows affected(0.01 sec) 可以建立,資料庫開啟這張表的預設引擎為MyISAM,但是這張表在建表時的引擎為INNODB;