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/p/2380622.html