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

MySQL版本:mysql5.7.21

修改用户权限,刷新权限表,报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;

后来,在做mysqldump全库备份时,同样报同样的错误,提示mysql下几张表不存在。后来更换一个安装包,没有在出现这个问题。

并且:安装过程中,初始化实例时,root@localhost临时密码,打印到错误日志里。

 

转载于:https://www.cnblogs.com/elontian/p/8670997.html

你可能感兴趣的:(ERROR 1146 (42S02): Table 'mysql.servers' doesn't exist)