再次执行上面命令,会打印用户的初始密码,其中@localhost : XXXXXX就是默认密码,需要记住,如果没有记住,就将后来生成的data文件删除,再次生成也是可以的
F:\mysql\mysql-8.0.11-winx\bin>mysqld --initialize --console
2018-10-29T09:28:49.177043Z 0 [System] [MY-013169] [Server] F:\mysql\mysql-8.0.11-winx\bin\mysqld.exe (mysqld 8.0.11) initializing of server in progress as process 12980
2018-10-29T09:29:19.270535Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: kw3AlnY_g.Dg
2018-10-29T09:29:41.684599Z 0 [System] [MY-013170] [Server] F:\mysql\mysql-8.0.11-winx\bin\mysqld.exe (mysqld 8.0.11) initializing of server has completed
3、然后安装服务, mysqld --install[服务名] 如果只有一个服务可以不写默认mysql,如果多个服务可以写具体的服务名称,XXXX,当回车之后,又出现错误, install/remove of the service deined,这是由于运行cmd的时候不是用管理员的身份运行的,只要再次以管理员的命令运行cmd就可以了,出现service successfully installed 说明服务安装好了。
F:\mysql\mysql-8.0.11-winx\bin>mysqld --install Service successfully installed.
4、启动服务,运行命令 : net start mysql ,看到服务已经启动成功
F:\mysql\mysql-8.0.11-winx\bin>net start mysql MySQL 服务正在启动 .... MySQL 服务已经启动成功。
5、更改密码和密码认证插件 ,
在MySQL安装目录的 bin 目录下执行命令:mysql -u root -p
F:\mysql\mysql-8.0.11-winx\bin>mysql -u root -p Enter password: ******* ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
这时要重新生成密码,删除data目录,运行mysqld --initialize --console,
F:\mysql\mysql-8.0.11-winx\bin>mysqld --initialize --console 2018-10-29T10:04:23.337650Z 0 [System] [MY-013169] [Server] F:\mysql\mysql-8.0.11-winx\bin\mysqld.exe (mysqld 8.0.11) initializing of server in progress as process 7928 2018-10-29T10:05:19.210237Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: RXZG!fJR2Ly+ 2018-10-29T10:06:00.603070Z 0 [System] [MY-013170] [Server] F:\mysql\mysql-8.0.11-winx\bin\mysqld.exe (mysqld 8.0.11) initializing of server has completed
重新执行mysql -u root -p,填入密码(注意密码左右没有空格),这时会打印出相关的信息
F:\mysql\mysql-8.0.11-winx\bin>mysql -u root -p
Enter password: ************
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.11
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
修改用户密码,在MySQL中执行命令:ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '新密码';,出现下面情况就证明你已经修改成功。
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '5502yulijian.'; Query OK, 0 rows affected (0.17 sec)
show databases; (‘;'一定要加)
这样就可以了
总结
以上所述是小编给大家介绍的解决Windows环境下安装 mysql-8.0.11-winx 遇到的问题,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!