default-storage-engine=INNODB
2、cmd管理员启动,cd到M\bin\
D:\Program Files\mysql-5.7.13-winx64\bin>mysqld --initialize a、这个命令会在D:\Program Files\mysql-5.7.13-winx64\生成data文件夹(初始化)
b、不初始化,自己创建一个空的data文件夹,就会出错:
MySQL 服务正在启动 . MySQL 服务无法启动。 服务没有报告任何错误。 请键入 NET 删除data文件夹,再执行mysqld --initialize
c、使用这个命令会生成root用户的随机的密码
如果使用--initialize-insecure生成的root用户的密码就为空
d、随机密码是什么?
官方文档是这样说的:
The server creates a 'root'@'localhost' superuser account. The server's action with respect to a
password for this account depends on how you invoke it:
With --initialize but not --initialize-insecure, the server generates a random password,
marks it as expired, and writes a message displaying the password:
[Warning] A temporary password is generated for root@localhost: iTag*AfrH5ej
就是说在D:\Program Files\mysql-5.7.13-winx64\data文件夹下的xxx.err文件中有root用户的密码,格式就是“A temporary password is generated for root@localhost: iTag*AfrH5ej”中的后12位。
e、如果不输密码就会出错:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: N O) 3、初始完后安装服务:
D:\Program Files\mysql-5.7.13-winx64\bin>mysqld install 4、成功后,启动mysql
D:\Program Files\mysql-5.7.13-winx64\bin>net start mysql 5、登录mysql:
D:\Program Files\mysql-5.7.13-winx64\bin>mysql -uroot -p 会提示你输入密码:
输入xxx.err中的密码:(我的是Pdk<hW<=,7.g)
6、登录后修改密码:
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass'); 结论:出错后,自己找官方(http://dev.mysql.com/doc/refman/5.7/en/)文档看