mysqld: Table 'mysql.plugin' doesn't exist

免安装版的MySQL 在启动服务时报错

到data文件夹下看到5个文件,打开后缀为.err的文件,里面提示:Table 'mysql.plugin' doesn't exist

针对这个问题的解决方案是:

1.把my.ini复制到\bin文件夹下;

2、清空data

3.在cmd到\bin目录,然后输入mysqld --initialize --user=mysql --console 执行此命令, 生成库. 注意有个临时密码, 要记下来;

D:\zz\MySQL5.7.28\bin>mysqld --initialize --user=mysql --console
2020-02-22T17:58:08.226335Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-02-22T17:58:08.229801Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2020-02-22T17:58:08.230461Z 0 [ERROR] Aborting


D:\zz\MySQL5.7.28\bin>mysqld --initialize --user=mysql --console
2020-02-22T17:58:27.709973Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-02-22T17:58:28.043111Z 0 [Warning] InnoDB: New log files created, LSN=45790
2020-02-22T17:58:28.109651Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2020-02-22T17:58:28.209667Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: eddbd49b-559c-11ea-bcf3-68f728758a85.
2020-02-22T17:58:28.214455Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2020-02-22T17:58:30.478578Z 0 [Warning] CA certificate ca.pem is self signed.
2020-02-22T17:58:31.290704Z 1 [Note] A temporary password is generated for root@localhost: tqZ*qZya&1iz

4.启动服务net start mysql;

5.进入mysql命令下:mysql -uroot -p,输入刚刚的密码;

6.再输入set password = password('root') 修改root的登录密码;

问题重现:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

D:\zz\MySQL5.7.28>mysqld --console
2020-02-22T17:51:02.210552Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-02-22T17:51:02.210635Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2020-02-22T17:51:02.211132Z 0 [Note] mysqld (mysqld 5.7.28) starting as process 172728 ...
2020-02-22T17:51:02.219070Z 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2020-02-22T17:51:02.220842Z 0 [Note] InnoDB: Uses event mutexes
2020-02-22T17:51:02.221231Z 0 [Note] InnoDB: _mm_lfence() and _mm_sfence() are used for memory barrier
2020-02-22T17:51:02.221875Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-02-22T17:51:02.223009Z 0 [Note] InnoDB: Number of pools: 1
2020-02-22T17:51:02.223551Z 0 [Note] InnoDB: Not using CPU crc32 instructions
2020-02-22T17:51:02.230480Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-02-22T17:51:02.244834Z 0 [Note] InnoDB: Completed initialization of buffer pool
2020-02-22T17:51:02.278022Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2020-02-22T17:51:02.304830Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-02-22T17:51:02.306177Z 0 [Note] InnoDB: Setting file '.\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-02-22T17:51:02.341771Z 0 [Note] InnoDB: File '.\ibtmp1' size is now 12 MB.
2020-02-22T17:51:02.345298Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2020-02-22T17:51:02.345674Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2020-02-22T17:51:02.346972Z 0 [Note] InnoDB: Waiting for purge to start
2020-02-22T17:51:02.398358Z 0 [Note] InnoDB: 5.7.28 started; log sequence number 1210170
2020-02-22T17:51:02.399470Z 0 [Note] Plugin 'FEDERATED' is disabled.
2020-02-22T17:51:02.401799Z 0 [Note] InnoDB: Loading buffer pool(s) from D:\zz\MySQL5.7.28\data\ib_buffer_pool
mysqld: Table 'mysql.plugin' doesn't exist
2020-02-22T17:51:02.403268Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2020-02-22T17:51:02.403734Z 0 [Note] InnoDB: Buffer pool(s) load completed at 200223  1:51:02
2020-02-22T17:51:02.404801Z 0 [ERROR] unknown variable 'max_connection=200'
2020-02-22T17:51:02.405413Z 0 [ERROR] Aborting

2020-02-22T17:51:02.405814Z 0 [Note] Binlog end
2020-02-22T17:51:02.406269Z 0 [Note] Shutting down plugin 'ngram'
2020-02-22T17:51:02.406674Z 0 [Note] Shutting down plugin 'partition'
2020-02-22T17:51:02.407101Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2020-02-22T17:51:02.407506Z 0 [Note] Shutting down plugin 'ARCHIVE'
2020-02-22T17:51:02.407891Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2020-02-22T17:51:02.409868Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2020-02-22T17:51:02.411020Z 0 [Note] Shutting down plugin 'MyISAM'
2020-02-22T17:51:02.411593Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2020-02-22T17:51:02.412367Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2020-02-22T17:51:02.412938Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2020-02-22T17:51:02.413533Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2020-02-22T17:51:02.414205Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2020-02-22T17:51:02.420458Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2020-02-22T17:51:02.421691Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2020-02-22T17:51:02.422417Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2020-02-22T17:51:02.423083Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2020-02-22T17:51:02.424219Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2020-02-22T17:51:02.424573Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2020-02-22T17:51:02.425202Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2020-02-22T17:51:02.429897Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2020-02-22T17:51:02.431315Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2020-02-22T17:51:02.431813Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2020-02-22T17:51:02.432592Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2020-02-22T17:51:02.433554Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2020-02-22T17:51:02.434753Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2020-02-22T17:51:02.435712Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2020-02-22T17:51:02.436232Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2020-02-22T17:51:02.436842Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2020-02-22T17:51:02.437580Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2020-02-22T17:51:02.438143Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2020-02-22T17:51:02.441120Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2020-02-22T17:51:02.442540Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2020-02-22T17:51:02.443218Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2020-02-22T17:51:02.443909Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2020-02-22T17:51:02.444690Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2020-02-22T17:51:02.446240Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2020-02-22T17:51:02.452924Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2020-02-22T17:51:02.454679Z 0 [Note] Shutting down plugin 'InnoDB'
2020-02-22T17:51:02.455274Z 0 [Note] InnoDB: FTS optimize thread exiting.
2020-02-22T17:51:02.456379Z 0 [Note] InnoDB: Starting shutdown...
2020-02-22T17:51:02.562170Z 0 [Note] InnoDB: Dumping buffer pool(s) to D:\zz\MySQL5.7.28\data\ib_buffer_pool
2020-02-22T17:51:02.569487Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 200223  1:51:02
2020-02-22T17:51:03.783327Z 0 [Note] InnoDB: Shutdown completed; log sequence number 1210189
2020-02-22T17:51:03.785274Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2020-02-22T17:51:03.787113Z 0 [Note] Shutting down plugin 'MEMORY'
2020-02-22T17:51:03.787638Z 0 [Note] Shutting down plugin 'CSV'
2020-02-22T17:51:03.788261Z 0 [Note] Shutting down plugin 'sha256_password'
2020-02-22T17:51:03.788864Z 0 [Note] Shutting down plugin 'mysql_native_password'
2020-02-22T17:51:03.789537Z 0 [Note] Shutting down plugin 'binlog'
2020-02-22T17:51:03.790709Z 0 [Note] mysqld: Shutdown complete

原因:

mysql在启动服务时会去找一些系统表,类似本案,创建服务后少了初始化,而初始化需要你把.ini放在bin目录下面

在bin目录下面执行mysqld --initialize

完毕后会看到data文件夹下面生成了一堆文件,即可启动服务

你可能感兴趣的:(mysqld: Table 'mysql.plugin' doesn't exist)