mysqladmin 設置用戶名初始密碼報錯you need the SUPER privilege for this operation

今天在linux上安裝了一下mysql5.5,按照mysql5.5 tar包中的INSTALL-BINARY中的instructions一步步坐了下來。

做完以後想要給root用戶配置一下密碼,在網上搜了一下發現配置密碼的方法是

[root@rac2 ~]# /usr/bin/mysqladmin -u root password root 如是這般

但是我運行了一下發現會報mysqladmin: Can't turn off logging; error: 'Access denied; you need the SUPER privilege for this operation'的錯誤

再次網上強力搜索之,發現有個解決方案:http://blog.sina.com.cn/s/blog_6fd605b50100q5es.html

主要思路就是登陸mysql之後對mysql系統的數據庫進行操作,更新User表中root用戶相對應的密碼

我locate了一下該博文中說的my.cnf文件發現好像沒啥用的樣子

所以我也就沒有完全按照該博文講的一步步坐下來,而是直接殺入mysql數據庫進行更新操作

[root@localhost Anylinux]# mysql

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 3.23.56

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> USE mysql ;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> UPDATE user SET Password = password ( 'anylinux' ) WHERE User = 'root' ;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 2 Changed: 0 Warnings: 0

mysql> flush privileges ;
Query OK, 0 rows affected (0.01 sec)

mysql> quit
Bye

 

看了一下感覺有了點思路,後來有需要在mysql裏面創建一個用戶,

於是到網上搜mysql創建用戶名的方法搜到了一個比較標準的方法:

 

http://www.databasef1.com/tutorial/mysql-create-user.html

CREATE USER 'user1'@'localhost' IDENTIFIED BY 'pass1';
GRANT SELECT,INSERT,UPDATE,DELETE ON *.* TO 'user1'@'localhost';
GRANT ALL ON *.* TO 'user1'@'localhost';

用上面第一句和第三句就完全搞定了


轉載於:https://www.cnblogs.com/ericsun/archive/2012/03/05/2380622.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章