標籤:mysql 密碼修改 破解
Mysql 資料庫密碼管理
1、密碼為空白時設定密碼為 123456:
mysqladmin -u root password ‘123456‘
2、知道現有密碼,需要修改密碼為 123123:
2.1、第一種設定方法
mysql -u root -p123456
mysql> use mysql;
mysql> update user set password=password(‘123123‘) where user="root";
mysql> flush privileges;
2.2、第二種設定方法
mysqladmin -u root -p password ‘123123‘
輸入老的密碼
3、MySQL 忘記密碼時,破解設定新的的密碼
[[email protected] ~]# mysql -u root -p12345678
ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)
停止資料庫:
[[email protected] ~]# service mysqld stop
Shutting down MySQL. [確定]
[[email protected] ~]# netstat -anptu |grep mysql
跳過授權表
[[email protected] ~]# mysqld_safe --skip-grant-tables &
[[email protected] ~]# mysql
mysql> use mysql;
mysql> update user set password=password(‘abcd‘) where user="root";
mysql> flush privileges;
mysql> exit
[[email protected] ~]# service mysqld stop
[[email protected] ~]# service mysqld start
使用新密碼串連測試
[[email protected] ~]# mysql -u root -p123123
本文出自 “Crushlinux” 部落格,請務必保留此出處http://crushlinux.blog.51cto.com/2663646/1539395