900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > windows mysql提示:1045 access denied for user 'root'@'localhost' using password yes 解决方案

windows mysql提示:1045 access denied for user 'root'@'localhost' using password yes 解决方案

时间:2022-06-06 21:46:08

相关推荐

windows mysql提示:1045 access denied for user 'root'@'localhost' using password yes 解决方案

win7 MySql5.6.17

提示:1045accessdeniedforuser'root'@'localhost'usingpasswordyes

从网上找到的解决方法,以此博客做笔记记录。

Windows:

1.管理员登陆系统,停止MySQL服务或者结束mysqld-nt进程

2.进入命令行,来到mysql的安装目录.假设安装目录为d:\mysql\,CMD进入命令行

3.运行d:\mysql\bin\mysqld-nt--skip-grant-tables启动mysql,关闭权限的检查

4.运行d:\mysql\bin\mysqladmin-urootflush-privilegespassword"newpassword"重设root密码

5.重新启动mysql服务,net stop mysql接着net start mysql,然后mysql -u root -p 输入密码即可登录

这个验证成功,mysql运行重新正常

Linux系统方法一:

#/etc/init.d/mysqlstop

#mysqld_safe--user=mysql--skip-grant-tables--skip-networking&

#mysql-urootmysql

mysql>UPDATEuserSETPassword=PASSWORD(’newpassword’)whereUSER=’root’;

mysql>FLUSHPRIVILEGES;

mysql>quit

#/etc/init.d/mysqlrestart

#mysql-uroot-p

Enterpassword:<输入新设的密码newpassword>

mysql>方法二:

直接使用/etc/mysql/f文件中[client]节提供的用户名和密码:

#mysql-udebian-sys-maint-p

Enterpassword:<输入[client]节的密码>

mysql>UPDATEuserSETPassword=PASSWORD(’newpassword’)whereUSER=’root’;

mysql>FLUSHPRIVILEGES;

mysql>quit

#mysql-uroot-p

Enterpassword:<输入新设的密码newpassword>

mysql>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。