我正在尝试为MariaDB 10上的用户授予特权,但出现错误1045
[root@lw343 ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 42
Server version: 10.0.11-MariaDB MariaDB Server
Copyright (c) 2000, 2014, Oracle, SkySQL Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [mysql]> select user,host from mysql.user;
+--------+-----------+
| user | host |
+--------+-----------+
| ruser | % |
| root | 127.0.0.1 |
| bill | localhost |
| nagios | localhost |
| root | localhost |
+--------+-----------+
5 rows in set (0.00 sec)
MariaDB [mysql]> select user(),current_user();
+----------------+----------------+
| user() | current_user() |
+----------------+----------------+
| root@localhost | root@localhost |
+----------------+----------------+
1 row in set (0.00 sec)
MariaDB [mysql]> show variables like 'skip_networking';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| skip_networking | OFF |
+-----------------+-------+
1 row in set (0.00 sec)
MariaDB [mysql]> GRANT ALL PRIVILEGES ON *.* TO root@"localhost" IDENTIFIED BY '**********' WITH GRANT OPTION;
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
MariaDB [mysql]>
我已经尝试了在互联网上找到的所有内容,但是遇到了同样的错误。
我也尝试创建新用户,但是我尝试授予的每个用户仍然遇到相同的错误。
有人可以帮我解决这个问题吗?
提前致谢。
最佳答案
好的,因此,首先了解用户是作为用户名/主机名组合创建的。因此root@localhost
与root@192.168.1.5
不同。对于远程连接,您不能使用root@localhost
,因为这是用于从localhost
连接的
因此,创建另一个用户。
其次,如果root@localhost
已经存在,则不要使用identified by
,因为您已经有密码...。
关于sql - 在MariaDB上授予特权,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27130069/