mysql忘记root密码的解决方法
来源:互联网 发布:手机网络信号不稳定 编辑:程序博客网 时间:2024/05/22 04:35
[root@test1 local]# mysql
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 1 to server version: 4.0.16-standard
Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
mysql>
出现了“mysql>”提示符。
增加了密码后的登录格式如下:
mysql -u root -p
Enter password: (输入密码)
其中-u后跟的是用户名,-p要求输入密码,回车后在输入密码处输入密码。
如果root用户设置了密码,并且我们不知道root用户的密码,当我们在Linux中使用mysql命令登录时,会报错ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)
解决办法;
1、停用mysql服务:# /etc/rc.d/init.d/mysqld stop
2、输入命令:# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
3、登入数据库:# mysql -u root mysql 4、mysql> use mysql;结果如下: Database changed
5、mysql> UPDATE user SET Password=PASSWORD('newpassword')where USER='newuser'; 结果如下:
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql>FLUSH PRIVILEGES; 结果如下:
Query OK, 0 rows affected (0.00 sec)
mysql> quit
# /etc/init.d/mysql restart
# mysql -u newuser–p
Enter password:newpassword
mysql><登录成功>
如果我们需要修改数据库用户的密码,我们可以这样做
方法1:
在mysql系统外,使用mysqladmin
# mysqladmin -u root -p password "test123"
Enter password: 【输入原来的密码】
方法2:
通过登录mysql系统,
# mysql -uroot -p
Enter password: 【输入原来的密码】
mysql>use mysql;
mysql> update user set password=passworD("test") where user='root';
mysql> flush privileges;
mysql> exit;
- mysql忘记root密码的解决方法
- mysql忘记root密码的解决方法
- mysql忘记root密码的解决方法 .
- 忘记mysql root密码的解决方法
- mysql的root密码忘记解决方法
- mysql root密码忘记的解决方法
- mysql忘记root密码的解决方法
- 忘记mysql root密码的解决方法
- windows mysql忘记root密码的解决方法
- 忘记Mysql的root密码解决方法
- mysql忘记root密码的解决方法
- mysql忘记root密码的解决方法
- Mysql 忘记root密码的完美解决方法
- Mysql 忘记root密码的解决方法
- Mysql 忘记root密码的完美解决方法
- Mysql 忘记root密码的解决方法
- Mysql 忘记root密码的完美解决方法
- MySQL忘记root密码解决方法
- 漫谈JS
- struts2_2014.6.12
- 用割圆术求圆周率π
- android.intent.category.LAUNCHER
- java定时器的使用(Timer)
- mysql忘记root密码的解决方法
- 【OpenCV】直方图应用:直方图均衡化,直方图匹配,对比直方图
- IOS开发实例-获取用户当前地理坐标
- 我自己都不知道症结所在.时刻总觉
- VS编译duilib项目时候的错误解决方法整理
- arc automatic referencing counting
- Unity3d Shader
- intel历代架构演进1——p6微架构
- linux 系统,查看某目录下有多少个文件