MySQL 没有 data 目录的解决方法或者重建 data 目录
原创 2016年04月18日 04:25:52
下载 MySQL 免安装(zip)版,从 5.7 版本以后,不再含有 data 目录,没有 data 目录也就是没有默认数据库,需要用户手动创建。
运行创建 data 的命令
D:\mysql\5.7.12\bin>mysqld --initialize-insecure --user=mysql
将自动创建默认目录于 home 位置,之后可以通过 my.ini 设置到任意位置
D:/mysql/5.7.12/data
创建完成并启动服务器,此时密码为空
/bin/mysql -u root -p 即可进入
简单的 my.ini 设置
文件位置默认 d:\mysql\5.7.12,设置服务时可以选为其他位置。
设置 data 目录和 bin 目录,且设置字符集为 utf-8.
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld]
# Remove leading