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