Bug #82843 MySQL Workbench fails to connect because of incorrect LastDefaultSchema escaping
Submitted: 2 Sep 2016 10:21 Modified: 3 Sep 2016 6:46
Reporter: Rob Janssen Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:6.0 - 6.3.7 OS:Microsoft Windows
Assigned to: CPU Architecture:Any

[2 Sep 2016 10:21] Rob Janssen
Description:
Yesterday I connected to MySQL server and everything was all fine and dandy. I created a schema and imported a backup and went along my merry way doing what I do. Last night I went home to get some sleep. This morning, after a cup of joe, I fired up MySQL Workbench (then 6.0.<something>) and tried to connect to one of the stored connections. This resulted in the following error message (http://i.imgur.com/WTfuUaw.png):

Your connection attempt failed for user '<username>' from your host to server at foo.bar.com:3306:
Type mismatch: expected type string, but got int

I lost an entire morning trying to figure out what was going on. My colleague could connect with MySQL Workbench fine (he was on 6.2.<something>). So I downloaded the latest (currently 6.3.7) and tried that. Still got the same error. I tried everything from changing the hostname to the IP of the host thinking the problem had something to do with the actual connection, resetting the passwordt etc. etc. Nothing helped; the only thing that helped was deleting the connection and creating a new one. FINALLY! I was back on my merry way and chalked it up as a fluke.

Then I came back from lunch, fired up MySQL Workbench again and lo and behold: the same frikkin' error. Digging deeper this time I finally went to the 'Advanced' tab of the connection and cleared the 'Others' text field and the problem was gone!? Taking another look at what I had just removed I noticed the "LastDefaultSchema=20160901" part... (http://i.imgur.com/CNi3bCM.png) Hmmm, that was the database I created yesterday and since then I'd been experiencing trouble. "Type mismatch: expected type string, but got int"... No, wait... That can't be! Seriously? I put quotes around the 20160901 part and, sure enough, the problem went away.

How to repeat:
1. Create a schema in MySQL with a numeric name [0-9] only
2. Connect MySQL Workbench to the server and set the schema created in step 1 as default schema
3. Close MySQL Workbench and use the same stored connection as used in step 2
4. Error is shown

Suggested fix:
Escape the LastDefaultSchema value correctly
[2 Sep 2016 10:22] Rob Janssen
Error

Attachment: ss1.png (image/png, text), 15.32 KiB.

[2 Sep 2016 10:22] Rob Janssen
Settings

Attachment: ss2.png (image/png, text), 13.07 KiB.

[2 Sep 2016 10:37] Rob Janssen
Step 3 should read:

3. Close MySQL Workbench >>and reopen it<< and use the same stored connection as used in step 2

But I'm pretty sure that was clear ;-)
[3 Sep 2016 6:46] Umesh Shastry
Hello Rob Janssen,

Thank you for the report.
Observed this with WB 6.3.7 on Win7.

Thanks,
Umesh