Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access denied for user 'ODBC'@'localhost'

Tags:

mysql

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.

like image 208
Chris Hall Avatar asked Jul 20 '14 19:07

Chris Hall


2 Answers

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.

like image 133
S Quint Avatar answered Oct 04 '22 21:10

S Quint


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.

regards,

Jake

like image 23
Jake Kington Avatar answered Oct 04 '22 20:10

Jake Kington