mysql安装:“root@localhost is created with an empty password !”,而非A temporary password is generated for

mysql安装:“root@localhost is created with an empty password !”,而非A temporary password is generated for问题 在安装 mysqd l 时 打开 DESKTOP 8UNK26K err 未发现密码 发现 Warning root localhostisc Pleaseconsid insecureopti 而非 Warning Atemporarypa iscreatedwit pleaseconsid

问题:在安装mysql时,打开DESKTOP-8UNK26K.err未发现密码,发现:

[Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option. 

而非:

[Warning] A temporary password is generated for root@localhost: 

原因:
mysql官网已经给出解决方案及原因:

The server creates a 'root'@'localhost' superuser account and other reserved accounts (see Reserved Accounts). Some reserved accounts are locked and cannot be used by clients, but 'root'@'localhost' is intended for administrative use and you should assign it a password. Server actions with respect to a password for the 'root'@'localhost' account depend 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 With --initialize-insecure, (either with or without --initialize because --initialize-insecure implies --initialize), the server does not generate a password or mark it expired, and writes a warning message: [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option. For instructions on assigning a new 'root'@'localhost' password, see Post-Initialization root Password Assignment. 

大概意思就是,如果之前初始化数据库时使用的是–initialize-insecure 命令,那么就不会出现密码。如果以–initialize初始化数据库,就会出现密码。initialize意为“不安全的,不可靠的”,这也就解释了为什么加上他就没有出现密码,及root的密码为空。

解决:
1、删除自己创建的data文件夹
2、以管理员身份cmd进入bin目录,关闭mysqld服务

D:\Program ~\MySQL\bin>mysqld -remove MySQL Service successfully removed. 

3、在bin目录执行mysqld --initialize,程序会自动创建刚才删掉的那个文件夹
4、在bin目录执行mysqld --install,重新安装mysql服务
5、在bin目录运行net start mysql,启动mysql服务
6、进入程序自动创建的那个文件夹,打开DESKTOP-8UNK26K.err,即可发现密码,问题解决。

今天的文章 mysql安装:“root@localhost is created with an empty password !”,而非A temporary password is generated for分享到此就结束了,感谢您的阅读。
编程小号
上一篇 2025-01-05 07:17
下一篇 2025-01-05 07:11

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/bian-cheng-ji-chu/102653.html