简体   繁体   English

OperationalError:(1698,“用户'cotequotey'@'localhost'的访问被拒绝”)

[英]OperationalError: (1698, “Access denied for user 'cotequotey'@'localhost'”)

Even after trying the methods in this thread ERROR 1698 (28000): Access denied for user 'superuser1'@'localhost' , I still have the same error with my username 'cotequotey' which reads: 即使尝试了该线程中的方法, 错误1698(28000):用户'superuser1'@'localhost'的访问被拒绝 ,我的用户名'cotequotey'仍然存在相同的错误,内容为:

OperationalError: (1045, "Access denied for user 'cotequotey'@'localhost' (using password: NO)")

And this username 'cotequotey' is the one that I have attributed the auth_socket plugin to, in order for that username to be the default instead of root. 这个用户名“ cotequotey”是我将auth_socket插件赋予的用户名,以便该用户名成为默认用户名而不是root用户。 So this is what my user table looks like: 所以这是我的用户表的样子:

mysql> select User,host,plugin, authentication_string from mysql.user;
+------------------+-----------+-----------------------+-------------------------------------------+
| User             | host      | plugin                | authentication_string                     |
+------------------+-----------+-----------------------+-------------------------------------------+
| root             | localhost | mysql_native_password | *B845F78DCA29B8AE945AB9CFFAC24A9D17EB5063 |
| mysql.session    | localhost | mysql_native_password | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| mysql.sys        | localhost | mysql_native_password | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| debian-sys-maint | localhost | mysql_native_password | *0C8DDC30A93F5F8834121C4DF8703A051E215166 |
| cotequotey       | localhost | auth_socket           |                                           |
+------------------+-----------+-----------------------+-------------------------------------------+
5 rows in set (0.00 sec)

Therefore, I expected my connection via 'cotequotey' to work without a password when I did the command: 因此,我希望在执行命令时通过“ cotequotey”进行的连接无需密码即可正常工作:

ubuntu:~/environment/RAD_Final (angela) $ mysql -u cotequotey
ERROR 1045 (28000): Access denied for user 'cotequotey'@'localhost'

However, this command in the console still produces the original error, so I'm wondering if anyone knows of a solution? 但是,控制台中的此命令仍然会产生原始错误,因此我想知道是否有人知道解决方案?

I'm wondering if it is a grant permissions issue, since my root grants permissions are the same as those for cotequotey@localhost. 我想知道这是否是授予权限的问题,因为我的根授予权限与cotequotey @ localhost的授予权限相同。 Wasn't sure if this made them clash. 不确定这是否会使他们发生冲突。

+---------------------------------------------------------------------+
| Grants for root@localhost                                           |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION        |
+---------------------------------------------------------------------+
+---------------------------------------------------------------------------+
| Grants for cotequotey@localhost                                           |
+---------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'cotequotey'@'localhost' WITH GRANT OPTION |
| GRANT PROXY ON ''@'' TO 'cotequotey'@'localhost' WITH GRANT OPTION        |
+---------------------------------------------------------------------------+

According to the docs : 根据文档

The socket plugin checks whether the socket user name (the operating system user name) matches the MySQL user name specified by the client program to the server. 套接字插件检查套接字用户名(操作系统用户名)是否与客户端程序向服务器指定的MySQL用户名匹配。 If the names do not match, the plugin checks whether the socket user name matches the name specified in the authentication_string column of the mysql.user system table row. 如果名称不匹配,则插件将检查套接字用户名是否与mysql.user系统表行的authentication_string列中指定的名称匹配。 If a match is found, the plugin permits the connection. 如果找到匹配项,则插件允许连接。 The authentication_string value can be specified using an IDENTIFIED ...AS clause with CREATE USER or ALTER USER. 可以使用带有CREATE USER或ALTER USER的IDENTIFIED ... AS子句来指定authentication_string值。

It looks like your mysql account name doesn't match your UNIX user name, and you don't have an alternate specified in the authentication_string field. 看来您的mysql帐户名与您的UNIX用户名不匹配,并且您在authentication_string字段中没有指定替代名称。

ADDENDUM: Essentially auth_socket says "if the operating system authenticated you, MySQL will trust you too." 附录:本质上auth_socket表示“如果操作系统对您进行了身份验证,则MySQL也将信任您。” The default to accomplish that is to check if the Linux account name and the MySQL account name match (so no one else can log into the machine and gain privileges by claiming to be you). 完成此操作的默认设置是检查Linux帐户名和MySQL帐户名是否匹配(因此,没有其他人可以登录到计算机并声称自己是您而获得特权)。 You can override this behavior by specifying an alternate name as explained in the documentation linked above. 您可以通过指定备用名称来覆盖此行为,如上面链接的文档中所述。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 OperationalError at /admin/login/(1698,“用户'root'@'localhost'的访问被拒绝”) - OperationalError at /admin/login/ (1698, "Access denied for user 'root'@'localhost'") MySQLdb._exceptions.OperationalError:(1698,“用户'root'@'localhost'的访问被拒绝”) - MySQLdb._exceptions.OperationalError: (1698, "Access denied for user 'root'@'localhost'") MySQL:django.db.utils.OperationalError:(1698,“访问被拒绝用户'root'@'localhost'”)具有正确的用户名和pw - MySQL: django.db.utils.OperationalError: (1698, “Access denied for user 'root'@'localhost'”) with correct username and pw 如何修复 django.db.utils.OperationalError: (1698, "Access denied for user 'root'@'localhost'") - How To fix django.db.utils.OperationalError: (1698, "Access denied for user 'root'@'localhost'") MySQL“错误 1698 (28000):用户 'root'@'localhost' 访问被拒绝” - MySQL "ERROR 1698 (28000): Access denied for user 'root'@'localhost'" 错误 1698 (28000): 拒绝用户 'root'@'localhost' 的访问 - ERROR 1698 (28000): Access denied for user 'root'@'localhost' 登录错误1698(28000):用户'root'@'localhost'的访问被拒绝 - Login ERROR 1698 (28000): Access denied for user 'root'@'localhost' SQLSTATE[HY000] [1698] 用户 'root'@'localhost' 的访问被拒绝 - SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' Laravel SQLSTATE[HY000] [1698] 用户 'root'@'localhost' 的访问被拒绝 - Laravel SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' mysql.connector.errors.ProgrammingError: 1698 (28000): 用户 'root'@'localhost' 拒绝访问 - mysql.connector.errors.ProgrammingError: 1698 (28000): Access denied for user 'root'@'localhost'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM