I'm importing a fairly large (100GB+) database from MySQL to PostgreSQL using pgloader. After a seemingly random amount of time the process dies with the following error:

An unhandled error condition has been signalled:
   Failed to connect to mysql at "localhost" (port 3306) as user "USER": MySQL Error [1045]: "Access denied for user 'USER'@'localhost' (using password: YES)"

That user has access to the database both before and after I get the error, so something goofy is going on. Sometimes it happens fairly early in migration. Sometimes it's near the end. Sometimes it happens while copying a table with lots of rows. Sometimes it happens on small tables.

The migration tool opens a new TCP connection for each table, so on a hunch I tried bumping the nofile limit for the mysql user up to 4096. My next attempt completed successfully, but subsequent tests have all failed.

My tests are failing on Ubuntu 14.04 running MySQL 5.5.41. Running the same process on OS X with MySQL 5.6.23 works correctly.

I can't find any errors logged anywhere (mysql error log, syslog or dmesg).

  • What happens if you do this as root? – Vérace May 7 '15 at 1:40
  • SET GLOBAL LOG_WARNINGS = 2; and try again. Then check the MySQL error log. – Michael - sqlbot May 7 '15 at 11:10
  • Well, turning up the logging got me something. Unfortunately it's the exact same error message :). Now to try it as root... – James Mason May 7 '15 at 17:06
  • Running as root seems to work. That doesn't tell me what's wrong, but it gets me past the problem. @Vérace, you want to post an answer I can accept? – James Mason May 8 '15 at 16:23
  • Usually, access denied error occurs, because one of the following reasons: typo/incorrect username, password or hostname / wrong privileges - this post will help you to start debugging this issue - rathishkumar.in/2017/04/… – Rathish Apr 10 '17 at 15:08

I've experienced problems like this before. It seems to happen when you don't exactly follow the instructions for creating users. There are normally two solutions - perform the operation as root. The other solution is to (re)create your user carefully - but if this is one-off data loading step, then root should be fine.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.