您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息

MySQL 忘记root密码_MySQL

2024/3/28 19:47:57发布4次查看
windows下
mysqld -nt --skip-grant-tables
mysqladmin -u root flush-privileges password newpassword 
----------------------------------------
提示:1045 access denied for user 'root'@'localhost' using password yes
前几天都好好的,昨天没弄,结果今天晚上过来提示上面的这个错误,重启mysql还是不可以
网上的方法看了几个但是不知道怎么弄
方法一: 
# /etc/init.d/mysql stop 
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking & 
# mysql -u root mysql 
mysql> update user set password=password(’newpassword’) where user=’root’; 
mysql> flush privileges; 
mysql> quit 
# /etc/init.d/mysql restart 
# mysql -uroot -p 
enter password:  
mysql> 
方法二: 
直接使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码: 
# mysql -udebian-sys-maint -p 
enter password:  
mysql> update user set password=password(’newpassword’) where user=’root’; 
mysql> flush privileges; 
mysql> quit 
# mysql -uroot -p 
enter password:  
mysql>
内容来自:  www.bitscn.com
另一个方法
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 -u root flush-privileges password newpassword 重设root密码
5. 重新启动mysql服务
第4步也可以直接修改mysql表,所用到的sql语句同linux部分,这里就不再重复了.
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录