Fedora 14下 MySQL 更改密码


不知为什么,Fedora 14下用yum安装MySQL后配置挺麻烦,现将更改密码的方法记录一下。

报错问题:

[root@www.bkjia.com mysql]# mysqladmin -u root password 123456
mysqladmin: Can't turn off logging; error: 'Access denied; you need the SUPER privilege for this operation'

是权限的问题么?不解

解决方法:

1. 修改文件/etc/my.cnf,在[mysqld]段中加入skip-grant-tables,就是在启动打开mysql时跳过权限验证,保存退出。

2.重启mysql服务[root@www.bkjia.com mysql]# service mysqld restart

3.登录mysql修改密码

  1. [root@www.bkjia.com mysql]# mysql  
  2. Welcome to the MySQL monitor.  Commands end with ; or \g.  
  3. Your MySQL connection id is 2  
  4. Server version: 5.1.56 Source distribution  
  5.   
  6. Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.  
  7. This software comes with ABSOLUTELY NO WARRANTY. This is free software,  
  8. and you are welcome to modify and redistribute it under the GPL v2 license  
  9.   
  10. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.  
  11.   
  12. mysql> USE mysql;  
  13. Reading table information for completion of table and column names  
  14. You can turn off this feature to get a quicker startup with -A  
  15.   
  16. Database changed  
  17. mysql> UPDATE user SET Password = password('passwd') WHERE User = 'root';  
  18. Query OK, 4 rows affected (0.00 sec)  
  19. Rows matched: 4  Changed: 4  Warnings: 0  
  20.   
  21. mysql> flush privileges;  
  22. Query OK, 0 rows affected (0.00 sec)  
  23.   
  24. mysql> quit  
4.配置文件/etc/my.cnf改回,重启服务即可

Good luck

相关内容

    暂无相关文章