11

I'm trying to transfer a schema from my personal machine to RDS via Workbench. I've exported an SQL dump file and am trying to import it into RDS. However, I get the following error:

Unhandled exception: local variable 'pwd' referenced before assignment

Check the log for more details.

The log file has this:

14:05:01 [WRN][wb_admin_export.py:process_db:277]: Task exited with code 1
14:05:01 [ERR][       pymforms]: Unhandled exception in Python code: 
Traceback (most recent call last):
  File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\wb_admin_export.py", line 1334, in _update_progress
    r = self.update_progress()
  File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\wb_admin_export.py", line 913, in update_progress
    self.start()
  File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\wb_admin_export.py", line 1323, in start
    password = self.get_mysql_password(self.bad_password_detected)
  File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\wb_admin_export.py", line 963, in get_mysql_password
    if pwd is None:
UnboundLocalError: local variable 'pwd' referenced before assignment

An earlier attempt yielded a little more detail:

14:00:24 [ERR][wb_admin_export.py:process_db:251]: Error from task: ERROR 1045 (28000): Access denied for user 'admin'@'<some_numbers_I_probably_shouldn't_share!>.skybroadband.com' (using password: YES)

14:00:24 [WRN][wb_admin_export.py:process_db:277]: Task exited with code 1
14:00:24 [ERR][       pymforms]: Unhandled exception in Python code: 
Traceback (most recent call last):
  File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\wb_admin_export.py", line 1334, in _update_progress
    r = self.update_progress()
  File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\wb_admin_export.py", line 913, in update_progress
    self.start()
  File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\wb_admin_export.py", line 1323, in start
    password = self.get_mysql_password(self.bad_password_detected)
  File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\wb_admin_export.py", line 963, in get_mysql_password
    if pwd is None:
UnboundLocalError: local variable 'pwd' referenced before assignment
14:00:43 [ERR][wb_admin_utils.py:page_activated:329]: Exception activating the page - 'Label' object has no attribute 'remove_from_parent'Error from task: ERROR 1045 (28000): Access denied for user 'admin'@'<some_numbers_I_probably_shouldn't_share!> (using password: YES)

This has confused me somewhat as I'm not using Python to transfer anything - I'm using Workbench. Clearly I have a password issue but what is it exactly and how do I fix it? I'm logged into RDS and can add or remove schemas/tables etc manually so Workbench knows what the correct passwords are...

1
  • The python code is part of mysql workbench. You probably stumbled upon a bug, so you should raise this as a bug with mysql.
    – Shadow
    Commented Oct 30, 2020 at 16:05

7 Answers 7

14

For me, the error is regarding db privilege:

mysqldump: Got error: 1044: Access denied for user 'myuser'@'%' to database 'mydb' when doing LOCK TABLES

You have to uncheck the lock-tables option from the "Advanced Options" available in the top right of the data exporter in MySQL Workbench.

If you're using command to export then add --lock-tables=FALSE flag.

enter image description here

2

I had the same problem; this error occurs when you type the wrong password. In my case, I forgot that I was working with the root user so when it asked me for the password I just had to leave the input blank and hit the continue button.

1

If you only want to migrate your DB Structure:

  • Open workbench
  • select the connection of your local DB
  • On the left, in the 'navigator' panel choose 'administration'
  • 'Data Export'
  • select the schema you want to export
  • on the right side of the window you should find a 'select box'. switch Dump Structure and Data to Dump Data only

In the same way, select Dump Data only when you will import it!

Honestly, I don't know exactly how it solved the error:

'UnboundLocalError: local variable 'pwd' referenced before assignment ',

but just moving the Structure without the data worked for me.

enter image description here

1
  • Thanks loads for this. As I never figured out how to fix this I ditched RDS. However, I'd like to have another go so will report back!!
    – Jossy
    Commented Apr 2, 2021 at 19:44
1

Go to C:\Users\User_Name\AppData\Roaming\MySQL\Workbench\sql_workspaces and delete the workspace of the server where you are getting error, or in easy way, you can delete all folders in sql_workspaces

1
  • This actually sorted the error, unlike the other answer's "Dump data only". Thanks! Commented Jan 24, 2022 at 13:36
0

I've got the same problem: answers with --lock-tables=FALSE and 'Dump Data only' didn't help in my case.

Workbench gave alert

Unhandled exception: local variable 'pwd' referenced before assignment';

But log tell me 'Access denied for user': workbench error log

Granting all privileges to user solved my problem:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
0

I had the same error while exporting the database, I had to create another user whose host is limited to my pc ip where workbench is installed instead of the %.

0

None of the provided answers have been able to help me, and although I don't yet have a fix, I have found a workaround.

When you begin the backup process, you'll see the Export Progress window and the associated error message:

Export Progress window and the associated error message

Notice it's use of --defaults-file. That points to a temporary file that contains the plaintext password of the MySQL user.

That's the problem. For some reason, Workbench fails if you try to reference the password through this file.

Here is the workaround:

After dismissing the error dialog, do the following:

  1. copy the command line from the Export Progress window and paste it into a command line window.
  2. Replace the --defaults-file argument with -p (which will allow you to manually enter your password instead of grabbing it from the temporary file).
  3. Add a redirect to your output file at the end of the command line.

Your command line should look something like this (but you'll almost certainly need to change the port number):

mysqldump.exe -p --host=localhost --port=53605 --default-character-set=utf8 --user=root --protocol=tcp --column-statistics=FALSE --skip-triggers "schema_name" > backup.sql

When you hit enter, you'll be asked for your password and the backup will proceed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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