mysql数据库启动密码_mysql第一次安装成功后初始化密码操作步骤
1.服务正常启动后,命令行窗口用管理员模式打开,输入mysql -u root -p 回车,输入密码
出现 ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: NO),关闭服务net stop MySQL。
2.用安全模式打开,mysqld --skip-grant-tables ,然后就不用管,再打开一个安全模式的命令行窗口,如直接再mysql安装路径下的bin目录下,再地址栏输入cmd再回车即可。
3.在当前这个命令行窗口下输入 mysql -u root -p,密码为空,直接回车;就可以进去了。
4.输入命令,下方二选一:
(老版本)update user set password=password(“123456”) where user=“root”;
(5.7.11)update user set authentication_string=password(“123456”) where user=“root”;
5.最后,flush privileges;就OK了。



