CentOS6.x中Mysql修改root密码


 在CentOS6.x中修改root密码的几种情况如下:

 1、记得当前root密码,需要更新密码,输入当前密码,进入mysql

# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3223
Server version: 5.7.13-log MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
mysql> use mysql;

mysql> update user set password=PASSWORD('XXXXX@2018~') where user='root';

mysql> flush privileges;

2、忘记root密码,需要强制修改

# /usr/local/mysql/bin/mysqld_safe ­­--skip­-grant-­tables &

# mysql

mysql> use mysql;

mysql> update user set password=password("XXXXX@2018~") where user="root";

mysql> flush privileges;

3、5.7.9 修改密码方法

mysql> update mysql.user set authentication_string=password('XXXXX@2018~') where user='root';

mysql> flush privileges;

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM