修改root账户密码
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpassword');
第一种方法:
mysqladmin -u root -pnewpass password "redhat"
第二种方法:使用set password命令:
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');
Query OK, 0 rows affected (0.00 sec)
第三种方法:使用update user直接登录数据库修改密码:
mysql> update user set password = password('newpass') where user = 'root';
Query OK, 5 rows affected (0.01 sec)
Rows matched: 5 Changed: 5 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> \q