安装mysql绿色版的时候
执行 mysqld --initialize-insecure --user=mysql 命令报错
–initialize specified but the data directory exists and is not writable. Aborting.
2022-01-05T07:55:44.894556Z 0 [ERROR] Aborting

D:\bin\mysql\mysql-5.7.36-winx64>mysqld --initialize-insecure --user=mysql
mysqld: Can't create/write to file '"Din\mysql\mysql-5.7.36-winx64\data"  # 璁剧疆mysql鏁版嵁搴撶殑鏁版嵁鐨勫瓨鏀剧洰褰曪紝蹇呴』鏄痙ata锛屾 垨鑰呮槸\xxx\data\is_writable' (Errcode: 2 - No such file or directory)
2022-01-05T07:55:44.889994Z 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.
2022-01-05T07:55:44.890043Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2022-01-05T07:55:44.890561Z 0 [ERROR] Can't find error-message file 'D:\bin\mysql\mysql-5.7.36-winx64\"Din\mysql\mysql-5.7.36-winx64"   # 璁 剧疆mysql鐨勫畨瑁呯洰褰昞share\errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2022-01-05T07:55:44.894266Z 0 [ERROR] --initialize specified but the data directory exists and is not writable. Aborting.
2022-01-05T07:55:44.894556Z 0 [ERROR] Aborting

解决方法:
my.ini文件里面的路径是双斜杠 //

[mysqld]
#skip-grant-tables 
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
 
# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
basedir ="D:\\bin\\mysql\\mysql-5.7.36-winx64\\"   # 设置mysql的安装目录 
datadir="D:\\bin\\mysql\\mysql-5.7.36-winx64\data\\"  # 设置mysql数据库的数据的存放目录,必须是data,或者是//xxx/data  
 
 
[mysqld]
explicit_defaults_for_timestamp=true
 
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 
 
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
 
#服务端的编码方式
character-set-server=utf8mb4
[client]
#客户端编码方式,最好和服务端保存一致
loose-default-character-set=utf8mb4
 
[WinMySQLadmin]  
Server = "D:\\bin\\mysql\\mysql-5.7.36-winx64\\bin\\mysqld.exe"
Logo

更多推荐