为用户“ODBC”@“localhost”而拒绝访问

时间:2022-03-01 20:37:40

I've looked everywhere an cannot seem to find a fix for this issue, despite tons of articles on it. Anyway, I'm attempting the following command

我到处找遍了,尽管有大量的文章,但似乎找不到解决这个问题的方法。不管怎样,我正在尝试下面的命令。

mysqldump -hlocalhost -uroot -p mydb mytable > myexportedtable.sql

This will occasionally result in the following error

这将偶尔导致以下错误。

mysqldump: Got error: 1045: Access denied for user 'ODBC'@'localhost' <using password:NO> when trying to connect

This is baffling for two reasons. One - I am specifying a root user in my command however it assumes I'm ODBC. Two - I only get this error occasionally. (more often than not). I am able to authenticate to the mysql interactive shell when specifying root but keep getting this error with mySQL dump. Any insight is greatly appreciated as I've been trouble shooting this for days now.

这令人困惑有两个原因。我在命令中指定根用户,但它假设我是ODBC。2 -我偶尔会得到这个错误。(往往)。在指定root用户时,我可以对mysql交互式shell进行身份验证,但在mysql转储文件中继续出现这个错误。任何洞察力都得到了极大的赞赏,因为我在这几天里一直在拍摄这个问题。

2 个解决方案

#1


4  

Type in the command manually. Sometimes copying and pasting the command changes the hyphen character (-). It is ignoring the username because it literally doesn't recognize a -u.

手动输入命令。有时,复制和粘贴命令会更改连字符(-)。它忽略了用户名,因为它根本不识别-u。

#2


1  

I recently had the error too.

我最近也犯了错误。

mysql --user=jake
ERROR 1045 (28000): Access denied for user 'jake'@'localhost' (using password: NO)

This seems to happens when you connect with the wrong user to the database, wrong password usage or when you connect from the wrong host or over the socket/port when you are not allowed to.

当您与错误的用户连接到数据库时,错误的密码使用,或者当您不被允许连接到错误的主机或端口/端口时,就会发生这种情况。

I suggest to check the access priviledges of the user like:

我建议检查用户的访问权限,比如:

mysql> SELECT user, host FROM mysql.user WHERE user = 'jake';
mysql> SHOW GRANTS FOR 'jake'@'localhost';

Perhaps also take a look at mysqlimport: Error: 1045, Access denied , which helped me a lot.

也许还可以看看mysqlimport:错误:1045,拒绝访问,这对我有很大帮助。

regards,

问候,

Jake

杰克

#1


4  

Type in the command manually. Sometimes copying and pasting the command changes the hyphen character (-). It is ignoring the username because it literally doesn't recognize a -u.

手动输入命令。有时,复制和粘贴命令会更改连字符(-)。它忽略了用户名,因为它根本不识别-u。

#2


1  

I recently had the error too.

我最近也犯了错误。

mysql --user=jake
ERROR 1045 (28000): Access denied for user 'jake'@'localhost' (using password: NO)

This seems to happens when you connect with the wrong user to the database, wrong password usage or when you connect from the wrong host or over the socket/port when you are not allowed to.

当您与错误的用户连接到数据库时,错误的密码使用,或者当您不被允许连接到错误的主机或端口/端口时,就会发生这种情况。

I suggest to check the access priviledges of the user like:

我建议检查用户的访问权限,比如:

mysql> SELECT user, host FROM mysql.user WHERE user = 'jake';
mysql> SHOW GRANTS FOR 'jake'@'localhost';

Perhaps also take a look at mysqlimport: Error: 1045, Access denied , which helped me a lot.

也许还可以看看mysqlimport:错误:1045,拒绝访问,这对我有很大帮助。

regards,

问候,

Jake

杰克