Windows上的MySQL安装-以及如何解决缺少的mysql.user? [英] MySQL installation on Windows - and how to fix missing mysql.user?

查看:115
本文介绍了Windows上的MySQL安装-以及如何解决缺少的mysql.user?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用旧的MySql 5.0安装.然后决定获取最新的5.7 .zip版本.

I was using an old MySql 5.0 installation. Then decided to get newest 5.7 .zip release.

这就是我所做的:

mysqld -initialize-insecure

(因为我打算仅将其用于localhost/root用户使用)

(As I intend to use this for localhost/root usage only)

这将在MySQL数据目录的根目录中创建一些文件.

This creates some files in the root of the MySQL data directory.

但是,正在运行

mysqld --console

给出错误

2017-02-03T02:52:01.076801Z 0 [错误]致命错误:无法打开和锁定 特权表:表'mysql.user'不存在

2017-02-03T02:52:01.076801Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exis

然后,我打算移动我的两个5.0数据库(每个数据库都位于旧的mysql 5.0数据目录"目录的子文件夹中.)

I then intended to move over my two 5.0 databases (each in a subfolder in my old mysql 5.0 "data dir" directory.)

然后我可以再运行 mysql_upgrade 吗?

我的完整错误日志在这里:

My full error log is here:

D:\ databases \ MySQL-5_7(x86)\ bin> mysqld-控制台 2017-02-03T02:52:00.227754Z 0 [警告]带有隐式的TIMESTAMP 不建议使用DEFAULT值.请用 --explicit_defaults_for_timestamp服务器选项(有关更多详细信息,请参阅文档). 2017-02-03T02:52:00.227754Z 0 [警告]'NO_ZERO_DATE', 'NO_ZERO_IN_DATE'和'ERROR_FOR_DIVISION_BY_ZERO'sql模式应为 与严格模式一起使用.它们将以严格模式合并到一个 将来的版本. 2017-02-03T02:52:00.227754Z 0 [警告] 未设置"NO_AUTO_CREATE_USER" SQL模式. 2017-02-03T02:52:00.227754Z 0 [注意] --secure-file-priv设置为 空值.与导入和导出数据有关的操作被禁用 2017-02-03T02:52:00.227754Z 0 [注意] mysqld(mysqld 5.7.17)正在启动 作为过程13872 ... 2017-02-03T02:52:00.235754Z 0 [注意] InnoDB: 互斥锁和rw_locks使用Windows互锁功能 2017-02-03T02:52:00.236754Z 0 [Note] InnoDB:使用事件互斥锁 2017-02-03T02:52:00.236754Z 0 [注意] InnoDB:内存屏障不是 用过的2017-02-03T02:52:00.237754Z 0 [注意] InnoDB:压缩表 使用zlib 1.2.3 2017-02-03T02:52:00.237754Z 0 [注意] InnoDB: 池:1 2017-02-03T02:52:00.238755Z 0 [注意] InnoDB:不使用CPU crc32指令2017-02-03T02:52:00.240755Z 0 [Note] InnoDB: 初始化缓冲池,总大小= 128M,实例= 1,块大小 = 128M 2017-02-03T02:52:00.249755Z 0 [Note] InnoDB:缓冲池的初始化完成2017-02-03T02:52:00.363762Z 0 [Note] InnoDB:受支持的最高文件格式是梭子鱼. 2017-02-03T02:52:00.498769Z 0 [Note] InnoDB:创建共享 临时表的表空间2017-02-03T02:52:00.499769Z 0 [注意] InnoDB:将文件'.\ ibtmp1'的大小设置为12 MB.物理上写 文件已满;请稍候... 2017-02-03T02:52:00.745783Z 0 [注意] InnoDB:文件'.\ ibtmp1'的大小现在为12 MB. 2017-02-03T02:52:00.933793Z 0 [注] InnoDB:找到96个重做回滚段. 96重做回滚 细分有效. 2017-02-03T02:52:00.934792Z 0 [Note] InnoDB:32 非重做回滚段处于活动状态. 2017-02-03T02:52:00.936793Z 0 [注意] InnoDB:等待清除启动2017-02-03T02:52:00.988797Z 0 [注] InnoDB:5.7.17开始;日志序列号1209961 2017-02-03T02:52:00.988797Z 0 [注意]插件'FEDERATED'已禁用. 2017-02-03T02:52:00.990797Z 0 [Note] InnoDB:正在加载缓冲池 从W:\ b-databases \ MySql \ 5.0.x \ data \ ib_buffer_pool mysqld:表 'mysql.plugin'不存在2017-02-03T02:52:00.991796Z 0 [错误] 无法打开mysql.plugin表.请运行mysql_upgrade创建 它. 2017-02-03T02:52:00.993796Z 0 [注意]加盐uuid发生器 变量,current_pid:13872,server_start_time:1486090320, bytes_sent:0,2017-02-03T02:52:00.993796Z 0 [Note] InnoDB:Buffer 池加载在170203 3:52:00 2017-02-03T02:52:00.997796Z完成 0 [注]生成的uuid:'bc608dfe-e9bb-11e6-b692-00248c156225', server_start_time:1486104192,bytes_sent:361844000 2017-02-03T02:52:00.997796Z 0 [警告]尚无现有的UUID 找到了,所以我们假设这是该服务器的第一次 开始了.生成新的UUID: bc608dfe-e9bb-11e6-b692-00248c156225. 2017-02-03T02:52:01.041799Z 0 [警告] Gtid表尚未准备好使用.桌子 无法打开"mysql.gtid_exected". 2017-02-03T02:52:01.041799Z 0 [警告]由于以下SSL库,导致无法设置SSL 错误:没有证书和私钥,SSL上下文不可用 2017-02-03T02:52:01.043799Z 0 [Note]服务器主机名(绑定地址): '*';端口:3306 2017-02-03T02:52:01.044802Z 0 [注意] IPv6是 可用的. 2017-02-03T02:52:01.045801Z 0 [Note]-'::'解析为 '::'; 2017-02-03T02:52:01.045801Z 0 [注意]服务器套接字创建于 IP:"::". 2017-02-03T02:52:01.054800Z 0 [警告]无法打开 优化程序成本常数表

D:\databases\MySQL-5_7(x86)\bin>mysqld --console 2017-02-03T02:52:00.227754Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2017-02-03T02:52:00.227754Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release. 2017-02-03T02:52:00.227754Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set. 2017-02-03T02:52:00.227754Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled 2017-02-03T02:52:00.227754Z 0 [Note] mysqld (mysqld 5.7.17) starting as process 13872 ... 2017-02-03T02:52:00.235754Z 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions 2017-02-03T02:52:00.236754Z 0 [Note] InnoDB: Uses event mutexes 2017-02-03T02:52:00.236754Z 0 [Note] InnoDB: Memory barrier is not used 2017-02-03T02:52:00.237754Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3 2017-02-03T02:52:00.237754Z 0 [Note] InnoDB: Number of pools: 1 2017-02-03T02:52:00.238755Z 0 [Note] InnoDB: Not using CPU crc32 instructions 2017-02-03T02:52:00.240755Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M 2017-02-03T02:52:00.249755Z 0 [Note] InnoDB: Completed initialization of buffer pool 2017-02-03T02:52:00.363762Z 0 [Note] InnoDB: Highest supported file format is Barracuda. 2017-02-03T02:52:00.498769Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables 2017-02-03T02:52:00.499769Z 0 [Note] InnoDB: Setting file '.\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... 2017-02-03T02:52:00.745783Z 0 [Note] InnoDB: File '.\ibtmp1' size is now 12 MB. 2017-02-03T02:52:00.933793Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active. 2017-02-03T02:52:00.934792Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active. 2017-02-03T02:52:00.936793Z 0 [Note] InnoDB: Waiting for purge to start 2017-02-03T02:52:00.988797Z 0 [Note] InnoDB: 5.7.17 started; log sequence number 1209961 2017-02-03T02:52:00.988797Z 0 [Note] Plugin 'FEDERATED' is disabled. 2017-02-03T02:52:00.990797Z 0 [Note] InnoDB: Loading buffer pool(s) from W:\b-databases\MySql\5.0.x\data\ib_buffer_pool mysqld: Table 'mysql.plugin' doesn't exist 2017-02-03T02:52:00.991796Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 2017-02-03T02:52:00.993796Z 0 [Note] Salting uuid generator variables, current_pid: 13872, server_start_time: 1486090320, bytes_sent: 0, 2017-02-03T02:52:00.993796Z 0 [Note] InnoDB: Buffer pool(s) load completed at 170203 3:52:00 2017-02-03T02:52:00.997796Z 0 [Note] Generated uuid: 'bc608dfe-e9bb-11e6-b692-00248c156225', server_start_time: 1486104192, bytes_sent: 361844000 2017-02-03T02:52:00.997796Z 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: bc608dfe-e9bb-11e6-b692-00248c156225. 2017-02-03T02:52:01.041799Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2017-02-03T02:52:01.041799Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key 2017-02-03T02:52:01.043799Z 0 [Note] Server hostname (bind-address): '*'; port: 3306 2017-02-03T02:52:01.044802Z 0 [Note] IPv6 is available. 2017-02-03T02:52:01.045801Z 0 [Note] - '::' resolves to '::'; 2017-02-03T02:52:01.045801Z 0 [Note] Server socket created on IP: '::'. 2017-02-03T02:52:01.054800Z 0 [Warning] Failed to open optimizer cost constant tables

2017-02-03T02:52:01.076801Z 0 [错误]致命错误:无法打开和锁定 特权表:表'mysql.user'不存在 2017-02-03T02:52:01.077801Z 0 [错误]正在中止

2017-02-03T02:52:01.076801Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist 2017-02-03T02:52:01.077801Z 0 [ERROR] Aborting

2017-02-03T02:52:01.078801Z 0 [注意] Binlog结束 2017-02-03T02:52:01.079801Z 0 [注意]正在关闭插件'ngram' 2017-02-03T02:52:01.079801Z 0 [注意]正在关闭插件分区" 2017-02-03T02:52:01.080801Z 0 [注意]正在关闭插件"BLACKHOLE" 2017-02-03T02:52:01.081801Z 0 [注意]正在关闭插件"ARCHIVE" 2017-02-03T02:52:01.081801Z 0 [注意]正在关闭插件 'PERFORMANCE_SCHEMA'2017-02-03T02:52:01.082801Z 0 [注意]正在关闭 插件'MRG_MYISAM'2017-02-03T02:52:01.082801Z 0 [注意]正在关闭 下插件'MyISAM'2017-02-03T02:52:01.083801Z 0 [注意]正在关闭 插件'INNODB_SYS_VIRTUAL'2017-02-03T02:52:01.083801Z 0 [注意] 关闭插件"INNODB_SYS_DATAFILES" 2017-02-03T02:52:01.084801Z 0 [注意]正在关闭插件 'INNODB_SYS_TABLESPACES'2017-02-03T02:52:01.084801Z 0 [注意]正在关闭 插件'INNODB_SYS_FOREIGN_COLS'2017-02-03T02:52:01.085801Z 0 [注意]关闭插件"INNODB_SYS_FOREIGN" 2017-02-03T02:52:01.087801Z 0 [注意]正在关闭插件 'INNODB_SYS_FIELDS'2017-02-03T02:52:01.088802Z 0 [注意]正在关闭 插件'INNODB_SYS_COLUMNS'2017-02-03T02:52:01.089802Z 0 [注意] 关闭插件'INNODB_SYS_INDEXES'2017-02-03T02:52:01.089802Z 0 [注意]正在关闭插件"INNODB_SYS_TABLESTATS" 2017-02-03T02:52:01.090802Z 0 [注意]正在关闭插件 'INNODB_SYS_TABLES'2017-02-03T02:52:01.091802Z 0 [注意]正在关闭 插件'INNODB_FT_INDEX_TABLE'2017-02-03T02:52:01.091802Z 0 [注意] 关闭插件"INNODB_FT_INDEX_CACHE" 2017-02-03T02:52:01.092802Z 0 [注意]正在关闭插件 'INNODB_FT_CONFIG'2017-02-03T02:52:01.093802Z 0 [注意]正在关闭 插件'INNODB_FT_BEING_DELETED'2017-02-03T02:52:01.093802Z 0 [注意] 关闭插件'INNODB_FT_DELETED'2017-02-03T02:52:01.094802Z 0 [注意]关闭插件"INNODB_FT_DEFAULT_STOPWORD" 2017-02-03T02:52:01.094802Z 0 [注意]正在关闭插件 'INNODB_METRICS'2017-02-03T02:52:01.095802Z 0 [注意]正在关闭 插件'INNODB_TEMP_TABLE_INFO'2017-02-03T02:52:01.097802Z 0 [注意] 关闭插件"INNODB_BUFFER_POOL_STATS" 2017-02-03T02:52:01.098802Z 0 [注意]正在关闭插件 'INNODB_BUFFER_PAGE_LRU'2017-02-03T02:52:01.099802Z 0 [注意]正在关闭 down插件'INNODB_BUFFER_PAGE'2017-02-03T02:52:01.099802Z 0 [注意] 关闭插件"INNODB_CMP_PER_INDEX_RESET" 2017-02-03T02:52:01.100802Z 0 [注意]正在关闭插件 'INNODB_CMP_PER_INDEX'2017-02-03T02:52:01.100802Z 0 [注意]正在关闭 down插件'INNODB_CMPMEM_RESET'2017-02-03T02:52:01.101802Z 0 [注意] 关闭插件'INNODB_CMPMEM'2017-02-03T02:52:01.102802Z 0 [注意]关闭插件"INNODB_CMP_RESET" 2017-02-03T02:52:01.102802Z 0 [注意]正在关闭插件"INNODB_CMP" 2017-02-03T02:52:01.103803Z 0 [注意]正在关闭插件 'INNODB_LOCK_WAITS'2017-02-03T02:52:01.103803Z 0 [注意]正在关闭 插件'INNODB_LOCKS'2017-02-03T02:52:01.104802Z 0 [注意]正在关闭 插件'INNODB_TRX'2017-02-03T02:52:01.104802Z 0 [注意]正在关闭 下插件'InnoDB'2017-02-03T02:52:01.105803Z 0 [Note] InnoDB:FTS 优化线程退出. 2017-02-03T02:52:01.107803Z 0 [注意] InnoDB: 正在启动关机... 2017-02-03T02:52:01.209808Z 0 [注意] InnoDB: 将缓冲池转储到 W:\ b数据库\ MySql \ 5.0.x \ data \ ib_buffer_pool 2017-02-03T02:52:01.214809Z 0 [Note] InnoDB:缓冲池转储 于170203 3:52:01 2017-02-03完成T2:52:02.408874Z 0 [注意] InnoDB:关闭已完成;日志序列号1209980 2017-02-03T02:52:02.408874Z 0 [注意] InnoDB:已删除临时 表空间数据文件:"ibtmp1" 2017-02-03T02:52:02.409874Z 0 [注意] 关闭插件"MEMORY" 2017-02-03T02:52:02.410874Z 0 [注意] 关闭插件"CSV" 2017-02-03T02:52:02.410874Z 0 [注意] 关闭插件'sha256_password'2017-02-03T02:52:02.411874Z 0 [注意]关闭插件'mysql_native_password' 2017-02-03T02:52:02.412874Z 0 [注意]正在关闭插件'binlog' 2017-02-03T02:52:02.412874Z 0 [Note] mysqld:Shutdown complete

2017-02-03T02:52:01.078801Z 0 [Note] Binlog end 2017-02-03T02:52:01.079801Z 0 [Note] Shutting down plugin 'ngram' 2017-02-03T02:52:01.079801Z 0 [Note] Shutting down plugin 'partition' 2017-02-03T02:52:01.080801Z 0 [Note] Shutting down plugin 'BLACKHOLE' 2017-02-03T02:52:01.081801Z 0 [Note] Shutting down plugin 'ARCHIVE' 2017-02-03T02:52:01.081801Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA' 2017-02-03T02:52:01.082801Z 0 [Note] Shutting down plugin 'MRG_MYISAM' 2017-02-03T02:52:01.082801Z 0 [Note] Shutting down plugin 'MyISAM' 2017-02-03T02:52:01.083801Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL' 2017-02-03T02:52:01.083801Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES' 2017-02-03T02:52:01.084801Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES' 2017-02-03T02:52:01.084801Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS' 2017-02-03T02:52:01.085801Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN' 2017-02-03T02:52:01.087801Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS' 2017-02-03T02:52:01.088802Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS' 2017-02-03T02:52:01.089802Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES' 2017-02-03T02:52:01.089802Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS' 2017-02-03T02:52:01.090802Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES' 2017-02-03T02:52:01.091802Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE' 2017-02-03T02:52:01.091802Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE' 2017-02-03T02:52:01.092802Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG' 2017-02-03T02:52:01.093802Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED' 2017-02-03T02:52:01.093802Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED' 2017-02-03T02:52:01.094802Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD' 2017-02-03T02:52:01.094802Z 0 [Note] Shutting down plugin 'INNODB_METRICS' 2017-02-03T02:52:01.095802Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO' 2017-02-03T02:52:01.097802Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS' 2017-02-03T02:52:01.098802Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU' 2017-02-03T02:52:01.099802Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE' 2017-02-03T02:52:01.099802Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET' 2017-02-03T02:52:01.100802Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX' 2017-02-03T02:52:01.100802Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET' 2017-02-03T02:52:01.101802Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM' 2017-02-03T02:52:01.102802Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET' 2017-02-03T02:52:01.102802Z 0 [Note] Shutting down plugin 'INNODB_CMP' 2017-02-03T02:52:01.103803Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS' 2017-02-03T02:52:01.103803Z 0 [Note] Shutting down plugin 'INNODB_LOCKS' 2017-02-03T02:52:01.104802Z 0 [Note] Shutting down plugin 'INNODB_TRX' 2017-02-03T02:52:01.104802Z 0 [Note] Shutting down plugin 'InnoDB' 2017-02-03T02:52:01.105803Z 0 [Note] InnoDB: FTS optimize thread exiting. 2017-02-03T02:52:01.107803Z 0 [Note] InnoDB: Starting shutdown... 2017-02-03T02:52:01.209808Z 0 [Note] InnoDB: Dumping buffer pool(s) to W:\b-databases\MySql\5.0.x\data\ib_buffer_pool 2017-02-03T02:52:01.214809Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 170203 3:52:01 2017-02-03T02:52:02.408874Z 0 [Note] InnoDB: Shutdown completed; log sequence number 1209980 2017-02-03T02:52:02.408874Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1" 2017-02-03T02:52:02.409874Z 0 [Note] Shutting down plugin 'MEMORY' 2017-02-03T02:52:02.410874Z 0 [Note] Shutting down plugin 'CSV' 2017-02-03T02:52:02.410874Z 0 [Note] Shutting down plugin 'sha256_password' 2017-02-03T02:52:02.411874Z 0 [Note] Shutting down plugin 'mysql_native_password' 2017-02-03T02:52:02.412874Z 0 [Note] Shutting down plugin 'binlog' 2017-02-03T02:52:02.412874Z 0 [Note] mysqld: Shutdown complete

这是my.ini文件:

And this is my.ini file:

[mysqld]
basedir=D:/databases/MySQL-5_7(x86)
datadir=W:/b-databases/MySql/5.0.x/data
port=3306
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

推荐答案

我现在可以正常工作-我重述了这里提到的内容,这次还创建了用户表.不太确定为什么它在开始之前就行不通,但仍然值得回答: https://dev.mysql.com/doc/refman/5.7/zh-CN/data-directory-initialization-mysqld.html

Somehow I got it working now - I redid what was mentioned here and this time the user tables were created as well. Not quite sure why it did not work befoe, but still deserves to be an answer: https://dev.mysql.com/doc/refman/5.7/en/data-directory-initialization-mysqld.html

这篇关于Windows上的MySQL安装-以及如何解决缺少的mysql.user?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆