'Why am I getting an "Unhandled exception"?
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...
Solution 1:[1]
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.
Solution 2:[2]
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 DatatoDump 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.
Solution 3:[3]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Atul Khanduri |
| Solution 2 | SherylHohman |
| Solution 3 | Harry Coder |


