Can‘t create directory ‘D:\develop erver\MySQL-8.0.20\data\‘ (OS errno 2 - No such file or director

Error message [Exception encountered during MySQL8.0 installation]

  • Order:mysqld --initialize --console
    Insert image description here

Cause Analysis:

Tip: It is because the installation directory of mysql and the storage directory of the mysql database data are set with backslashes.

For example: D:/develop/server/MySQL-8.0.20If you write like this, the above exception may occur in the Windows environment, but D:\\develop\\server\\MySQL-8.0.20writing like this can avoid the above exception.


Solution: [Modify my.ini configuration file]

[mysqld]
# 设置3306端口
port=3306
# 设置mysql的安装目录   ----------是你的文件路径-------------
basedir=D:\\develop\\server\\MySQL-8.0.20
# 设置mysql数据库的数据的存放目录  ---------是你的文件路径data文件夹自行创建
datadir=D:\\develop\\server\\MySQL-8.0.20\\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
# 跳过密码验证
#skip-grant-tables
  • Execute the command to install again:mysqld --initialize --console
    Insert image description here

Guess you like

Origin blog.csdn.net/Lance_welcome/article/details/128384592