MYSQL8.0.27 ERROR 1146 (42S02): Table ‘mysql.role_edges‘ doesn‘t exist

MYSQL ERROR 1146 (42S02): Table ‘mysql.role_edges’ doesn’t exist

1、报错提示

>create user test@'%' identified by 'test123';

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

百度查找说升级少了一步,用下面升级

mysql_upgrade -u root -p

但是我用这个都报错

2、解决办法

#进库看了一下,确实没有这张表了

CREATE TABLE `role_edges` (
  `FROM_HOST` char(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '',
  `FROM_USER` char(32) COLLATE utf8_bin NOT NULL DEFAULT '',
  `TO_HOST` char(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '',
  `TO_USER` char(32) COLLATE utf8_bin NOT NULL DEFAULT '',
  `WITH_ADMIN_OPTION` enum('N','Y') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'N',
  PRIMARY KEY (`FROM_HOST`,`FROM_USER`,`TO_HOST`,`TO_USER`)
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_bin STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='Role hierarchy and role grants';


#我这个是8.0.27版本的,从其他相同的环境找了个建表语句,创建这个表后就能创建用户了

建表语句仅限8.0.27版本的数据库,其他版本不确定是否相同,仅供参考

你可能感兴趣的:(Mysql无师自通,mysql,数据库)