MySQL修改密码
1.设置root密码(root密码为空时)
|
1
|
mysqladmin -uroot password "new123"; |
2.修改mysql密码(3种方法)
|
1
2
3
4
|
1)mysqladmin -uroot -poldboy123 password "new123";2)mysql>update mysql.user set password=password("oldboy123") where user='root' and host='localhost';mysql>flush privileges;3)mysql> set password=password("123"); |
3.忘记密码
|
1
2
3
4
|
1)首先关闭mysql2) 跳过验证启动 mysqld_safe --skip-grant-tables &3)使用修改mysql密码的方式进行修改建议(第二种方法)4)重新启动mysql |
4.创建超级用户
|
1
2
|
mysql> grant all privileges on *.* to 'system'@'localhost' identified by 'oldboy123' with grant option;mysql> flush privileges; |
5.多实例mysql修改密码
|
1
|
mysqladmin -uroot -poldboy123 password "new123" -S /data/3306/mysql.sock |
6.忘记密码
|
1
|
mysqld_safe --defaults-file=/data/3306/my.cnf --skip-grant-tables & |
浙公网安备 33010602011771号