latest posts

I recently needed to migrate a database from SQL Server to MySQL, knowing the reverse could be easily done with the Microsoft SQL Server Migration Assistant tool I wasn't entirely sure how to achieve the opposite. Figuring MySQL Workbench(in my opinion the best "SQL Management Studio" equivalent for MySQL) had something similar built in, I was pleasantly surprised to find the Migration menu option. I entered my SQL Server credentials and my local MySQL database, but was presented with an undescript error, so I proceeded to the logs:
[bash] File "C:\Program Files (x86)\MySQL\MySQL Workbench 6.1 CE\modules\db_mssql_grt.py", line 186, in getCatalogNames return [ row[0] for row in execute_query(connection, query) ] File "C:\Program Files (x86)\MySQL\MySQL Workbench 6.1 CE\modules\db_mssql_grt.py", line 62, in execute_query return get_connection(connection_object).cursor().execute(query, *args, **kwargs) pyodbc.ProgrammingError: ('42000', "[42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Could not find stored procedure 'sp_databases'. (2812) (SQLExecDirectW)") Traceback (most recent call last): File "C:\Program Files (x86)\MySQL\MySQL Workbench 6.1 CE\workbench\wizard_progress_page_widget.py", line 192, in thread_work self.func() File "C:\Program Files (x86)\MySQL\MySQL Workbench 6.1 CE\modules\migration_source_selection.py", line 439, in task_fetch_schemata self.main.plan.migrationSource.doFetchSchemaNames(only_these_catalogs) File "C:\Program Files (x86)\MySQL\MySQL Workbench 6.1 CE\modules\migration.py", line 241, in doFetchSchemaNames catalog_names = self.getCatalogNames() File "C:\Program Files (x86)\MySQL\MySQL Workbench 6.1 CE\modules\migration.py", line 205, in getCatalogNames return self._rev_eng_module.getCatalogNames(self.connection) SystemError: ProgrammingError("('42000', "[42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Could not find stored procedure 'sp_databases'. (2812) (SQLExecDirectW)")"): error calling Python module function DbMssqlRE.getCatalogNames ERROR: Retrieve schema list from source: ProgrammingError("('42000', "[42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Could not find stored procedure 'sp_databases'. (2812) (SQLExecDirectW)")"): error calling Python module function DbMssqlRE.getCatalogNames Failed [/bash] Needing to get this migration performed ASAP, I proceeded to line 186 in C:\Program Files (x86)\MySQL\MySQL Workbench 6.1 CE\modules\db_mssql_grt.py:
query = 'exec sp_databases' ]]>
Knowing this was wrong I adjusted it to:
query = 'exec sys.sp_databases' ]]>
Saved and then restarted the Migration Tool - no errors and my migration proceeded to work perfectly. Hopefully that helps someone else out there. I know version 6.0 and 6.1 of MySQL Workbench are affected by this bug.

Having been years since I messed with MySQL on a non-Windows platform I had forgotten 2 simple commands after setup on my Origin 300: [sql] CREATE USER 'dbuser'@'%' IDENTIFIED BY 'sqlisawesome'; [/sql] [sql] GRANT ALL PRIVILEDGES ON *.* TO 'dbuser'@'%' WITH GRANT OPTION; [/sql] The wildcard (%) after the username is key if you want access from other machines (which in my case I wanted to the MySQL Workbench on my Windows 7 machine).