关于mysql安装过程中命令mysqld initialize console出错的解答

2023年 11月 26日 57.2k 0

在进行mysql数据库安装时遇到以下问题,在网上找了一圈高赞帖子,但是都没有解决。

F:\study\mysql\mysql-8.0.25-winx64\bin>mysqld --initialize --console
2021-07-11T14:28:40.798214Z 0 [System] [MY-013169] [Server] F:\study\mysql\mysql-8.0.25-winx64\bin\mysqld.exe (mysqld 8.0.25) initializing of server in progress as process 5896
2021-07-11T14:28:40.815000Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2021-07-11T14:28:40.815015Z 0 [ERROR] [MY-013236] [Server] The designated data directory F:\study\mysql\mysql-8.0.25-winx64\ is unusable. You can remove all files that the server added to it.
2021-07-11T14:28:40.821104Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-07-11T14:28:40.822328Z 0 [System] [MY-010910] [Server] F:\study\mysql\mysql-8.0.25-winx64\bin\mysqld.exe: Shutdown complete (mysqld 8.0.25) MySQL Community Server - GPL.

 

最后的解决的措施有2步:

1、设置my.ini文件(如下)

2、设置数据库的数据存放目录:datadir=F:/study/mysql/mysql-8.0.25-winx64/data,同时确保data目录下没有文件,为空

3、将mysql安装地址配置到系统环境变量

[mysqld]
# 设置3306端口
port=3306
# 设置mysql的安装目录
basedir=F:/study/mysql/mysql-8.0.25-winx64
# 设置mysql数据库的数据的存放目录
datadir=F:/study/mysql/mysql-8.0.25-winx64/data
# 允许最大连接数
max_connections=200
# 允许连接失败的次数。
max_connect_errors=10
# 服务端使用的字符集默认为utf8mb4
character-set-server=utf8mb4
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
# 默认使用“mysql_native_password”插件认证
#mysql_native_password
default_authentication_plugin=mysql_native_password
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8mb4
[client]
# 设置mysql客户端连接服务端时默认使用的端口
port=3306
default-character-set=utf8mb4

 

再次执行就ok了.

F:\study\mysql\mysql-8.0.25-winx64\bin>mysqld --initialize --console
2021-07-11T14:55:39.337661Z 0 [System] [MY-013169] [Server] F:\study\mysql\mysql-8.0.25-winx64\bin\mysqld.exe (mysqld 8.0.25) initializing of server in progress as process 17800
2021-07-11T14:55:39.446137Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-07-11T14:55:43.233879Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-07-11T14:55:49.341436Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: XXXXXX

在进行mysql数据库安装时遇到以下问题,在网上找了一圈高赞帖子,但是都没有解决。

F:\study\mysql\mysql-8.0.25-winx64\bin>mysqld --initialize --console
2021-07-11T14:28:40.798214Z 0 [System] [MY-013169] [Server] F:\study\mysql\mysql-8.0.25-winx64\bin\mysqld.exe (mysqld 8.0.25) initializing of server in progress as process 5896
2021-07-11T14:28:40.815000Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2021-07-11T14:28:40.815015Z 0 [ERROR] [MY-013236] [Server] The designated data directory F:\study\mysql\mysql-8.0.25-winx64\ is unusable. You can remove all files that the server added to it.
2021-07-11T14:28:40.821104Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-07-11T14:28:40.822328Z 0 [System] [MY-010910] [Server] F:\study\mysql\mysql-8.0.25-winx64\bin\mysqld.exe: Shutdown complete (mysqld 8.0.25) MySQL Community Server - GPL.

 

最后的解决的措施有2步:

1、设置my.ini文件(如下)

2、设置数据库的数据存放目录:datadir=F:/study/mysql/mysql-8.0.25-winx64/data,同时确保data目录下没有文件,为空

3、将mysql安装地址配置到系统环境变量

[mysqld]
# 设置3306端口
port=3306
# 设置mysql的安装目录
basedir=F:/study/mysql/mysql-8.0.25-winx64
# 设置mysql数据库的数据的存放目录
datadir=F:/study/mysql/mysql-8.0.25-winx64/data
# 允许最大连接数
max_connections=200
# 允许连接失败的次数。
max_connect_errors=10
# 服务端使用的字符集默认为utf8mb4
character-set-server=utf8mb4
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
# 默认使用“mysql_native_password”插件认证
#mysql_native_password
default_authentication_plugin=mysql_native_password
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8mb4
[client]
# 设置mysql客户端连接服务端时默认使用的端口
port=3306
default-character-set=utf8mb4

 

再次执行就ok了.

F:\study\mysql\mysql-8.0.25-winx64\bin>mysqld --initialize --console
2021-07-11T14:55:39.337661Z 0 [System] [MY-013169] [Server] F:\study\mysql\mysql-8.0.25-winx64\bin\mysqld.exe (mysqld 8.0.25) initializing of server in progress as process 17800
2021-07-11T14:55:39.446137Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-07-11T14:55:43.233879Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-07-11T14:55:49.341436Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: XXXXXX

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论