【发布时间】:2015-01-23 15:42:40
【问题描述】:
我正在尝试为 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 帐户应该已经拥有所有权限。毕竟,这是默认帐户。它应该具有所有特权,因此它可以创建其他特权较低的帐户。
show grants for root@localhost显示什么? -
授予选择、插入、更新、删除、创建、删除、重新加载、关闭、处理、文件、参考、索引、更改、显示数据库、超级、创建临时表、锁定表、执行、复制SLAVE、REPLICATION CLIENT、CREATE VIEW、SHOW VIEW、CREATE ROUTINE、ALTER ROUTINE、CREATE USER、EVENT、TRIGGER ON . TO 'root'@'localhost' IDENTIFIED by PASSWORD '****** ************' 带有授权选项
-
但是我还是不能远程连接到数据库
-
无法连接怎么办?没有权限?拒绝连接? per.den 是账号问题,con.ref 是网络问题(防火墙,或者mysql没有监听默认端口等)。
-
我拒绝用户“root”访问(使用密码:是)
标签: sql root mariadb grant mysql-error-1045