小编Ste*_*ten的帖子

尝试授予权限时,用户"root"@"localhost"的访问被拒绝.我如何授予特权?

我看了很多类似的问题,所以我证明我已经检查了基础知识.当然,这并不意味着我没有错过任何完全明显的东西.:-)

我的问题是:为什么我拒绝具有执行我正在尝试的权限的用户以及我已经输入密码并被授予访问权限的用户的访问权限?(为了完整起见,我尝试输入错误的密码,以确保MySQL客户端在程序启动时拒绝我访问.)

背景:

通过ssh登录到运行MySQL服务器的机器的shell,我以root身份登录:

[myname@host ~]$ mysql -u root -p -hlocalhost
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 62396
Server version: 5.5.18-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
Run Code Online (Sandbox Code Playgroud)

真棒.我阅读类似问题的答案表明,我应该确保权限与授权表中的内容一致

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> 
Run Code Online (Sandbox Code Playgroud)

接下来确保我是我认为的我:

mysql> SELECT user();
+----------------+
| user()         |
+----------------+
| root@localhost |
+----------------+
1 row in …
Run Code Online (Sandbox Code Playgroud)

mysql mysql-error-1045

163
推荐指数
8
解决办法
54万
查看次数

标签 统计

mysql ×1

mysql-error-1045 ×1