MySQL Workbench Migration from MSSQL: Windows Authentication with AzureAD - mysql

TL;DR: Having trouble identifying the correct server, username, and password combination to connect MySQL to an existing MSSQL database using Windows Authentication. Will I need to create a separate user for the migration, or is it possible to connect to MySQL in the Migration Wizard using MSSQL Windows Authentication?
Background and Debugging Steps
I received a BAK file which I would like to import into my existing MySQL installation. I have successfully imported the BAK file into Microsoft SQL Server Management Studio 18 (MSSQL). I am now trying to migrate the database to MySQL using the Database Migration Wizard in MySQL Workbench 8.0.27.
I believe the issue I am running into relates to authentication. In MSSQL I am connecting to the server using Windows Authentication. My User name is "AzureAD\ZachLonghofer" and MSSQL takes care of the password. In the MySQL migration wizard, using the default connection method, I receive this message log:
Starting...
Connect to source DBMS...
- Connecting to source...
Connecting to Mssql#MS Access Database...
Opening ODBC connection to DSN=MS Access Database;DATABASE=;UID=AzureAD\ZachLonghofer;PWD=XXXX...
ERROR: Connection failed: No open connection to Mssql#MS Access Database
Connecting to Mssql#MS Access Database...
Opening ODBC connection to DSN=MS Access Database;DATABASE=;UID=AzureAD\ZachLonghofer;PWD=XXXX...
ERROR: Connection failed: No open connection to Mssql#MS Access Database
Traceback (most recent call last):
File "C:\Program Files\MySQL\MySQL Workbench 8.0\workbench\wizard_progress_page_widget.py", line 71, in run
self.func()
File "C:\Program Files\MySQL\MySQL Workbench 8.0\modules\migration_source_selection.py", line 455, in task_connect
raise e
File "C:\Program Files\MySQL\MySQL Workbench 8.0\modules\migration_source_selection.py", line 439, in task_connect
if not self.main.plan.migrationSource.connect():
File "C:\Program Files\MySQL\MySQL Workbench 8.0\modules\migration.py", line 199, in connect
self._rev_eng_module.connect(self.connection, self.password or "")
SystemError: NotConnectedError("No open connection to Mssql#MS Access Database"): error calling Python module function DbMssqlRE.connect
ERROR: Error during Connect to source DBMS: NotConnectedError("No open connection to Mssql#MS Access Database"): error calling Python module function DbMssqlRE.connect
ERROR: Exception in task 'Connect to source DBMS': SystemError('NotConnectedError("No open connection to Mssql#MS Access Database"): error calling Python module function DbMssqlRE.connect')
Failed
I also tried using ODBC (native) and specifying the Server: ZLONGHOFER\SQLEXPRESS01 -- which is what shows as the server in MSSQL. With this configuration, I receive this message log, which is identical until after the traceback:
Starting...
Connect to source DBMS...
- Connecting to source...
Connecting to Mssql#DRIVER=SQL Server;SERVER=ZLONGHOFER\SQLEXPRESS01...
Opening ODBC connection to DRIVER={SQL Server};SERVER=ZLONGHOFER\SQLEXPRESS01;DATABASE={};UID=AzureAD\ZachLonghofer;PWD=XXXX;...
Connecting to Mssql#DRIVER=SQL Server;SERVER=ZLONGHOFER\SQLEXPRESS01...
Opening ODBC connection to DRIVER={SQL Server};SERVER=ZLONGHOFER\SQLEXPRESS01;DATABASE={};UID=AzureAD\ZachLonghofer;PWD=XXXX;...
Connecting to Mssql#DRIVER=SQL Server;SERVER=ZLONGHOFER\SQLEXPRESS01...
Opening ODBC connection to DRIVER={SQL Server};SERVER=ZLONGHOFER\SQLEXPRESS01;DATABASE={};UID=AzureAD\ZachLonghofer;PWD=XXXX;...
Traceback (most recent call last):
File "C:\Program Files\MySQL\MySQL Workbench 8.0\workbench\wizard_progress_page_widget.py", line 71, in run
self.func()
File "C:\Program Files\MySQL\MySQL Workbench 8.0\modules\migration_source_selection.py", line 455, in task_connect
raise e
File "C:\Program Files\MySQL\MySQL Workbench 8.0\modules\migration_source_selection.py", line 439, in task_connect
if not self.main.plan.migrationSource.connect():
File "C:\Program Files\MySQL\MySQL Workbench 8.0\modules\migration.py", line 199, in connect
self._rev_eng_module.connect(self.connection, self.password or "")
grt.DBLoginError: [28000] [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'AzureAD\ZachLonghofer'. (18456) (SQLDriverConnect); [28000] [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'AzureAD\ZachLonghofer'. (18456)
ERROR: Error during Connect to source DBMS: [28000] [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'AzureAD\ZachLonghofer'. (18456) (SQLDriverConnect);
[28000] [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'AzureAD\ZachLonghofer'. (18456)
ERROR: Exception in task 'Connect to source DBMS': DBLoginError("[28000] [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'AzureAD\\ZachLonghofer'. (18456) (SQLDriverConnect); [28000] [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'AzureAD\\ZachLonghofer'. (18456)")
Failed
Windows Authentication
The password I am using is my windows user password. I'm fairly certain I've never set a password for MSSQL: I've only ever used Windows Authentication and I thought the username and password would parallel my Windows Login and Password, but it seems not.
It also occurs to me that I may need to create a user in MSSQL if it may not be possible to import to MySQL using Windows Authentication connection to MSSQL. If so, I will need to [figure out how to] create a separate user in MSSQL to do the migration.
Will I need to create a separate user for the migration, or is it possible to connect to MySQL in the Migration Wizard using MSSQL Windows Authentication?

TL;DR;
When you log in on a Windows machine you use Windows Authentication. The user logged in is the same one used by the SSMS, this one doesn't take care of your password simply because it doesn't need you are already authenticated to Windows, and this "mechanism" is the same for every program you use.
Your question omitted the most important "piece": the connection string or at least the code/library you use to connect to MsSQL Server.
Microsoft SQL Server (on premises) can run in two mode:
Integrated authentication only
Mixed mode -> Integrated authentication AND Sql Server authentication
On mode 1 you can only login to SQL Server using Windows Authentication only whenever on mode 1 you can use Windows Auth and users created directly on SQL Server.
From the log I see
Opening ODBC connection to DRIVER={SQL Server};SERVER=ZLONGHOFER\SQLEXPRESS01;DATABASE={};UID=AzureAD\ZachLonghofer;PWD=XXXX;
UID and PWD are symptoms using a Sql Server Authentication NOT Windows Authentication.
TODO
If you want to use Windows Authentication you must remove user and password from your connection string and add Integrated Security=true; this specify to use the Win Auth see here for connection strings
If you want to use a SQL Server User, you must create a user and assign at least the reader of the DB and then use the username and password, here a tutorial on how to

Related

[MySQL][ODBC 5.3(a) Driver]Can't connect to MySQL server

I have difficulty connecting to MySQL server from Tableau Server.
The error message is:
[MySQL][ODBC 5.3(a) Driver]
Can't connect to MySQL server on XYZ.
Unable to connect to the MySQL server "xyz".
Check that the server is running and that you have access privileges to the requested database
I have installed MySQL ODBC 5.3 Driver from tarball distribution in Ubuntu OS, and whitelisted the IP address of Tableau server in MySQL server.
What could be the possible causes for this? And is there any way that I check the ODBC connector was properly installed?
Any suggestion/comments are much appreciated!
Reasons, you could not connect could be different. But the error you've get asks you to check if server is running. It means, it could not find server.
The reasons, it could not find server, could be:
Server is down (Check its status by systemctl status mysql)
Server is not listening on some port your app connects to
Server is behind firewall (sudo ufw allow mysql command execution required to solve it in this case)
Your user does not have permissions to access that database, as it states in the error

MySQL Command Line Client closing after entering password without any error

I'm using Windows Server 2016. I need MySQL for my school project. Now I've installed it and want to create a new database for Wordpress. The Problem that I have is, that when I enter my password in the Command Line Client the Client closes without any Error message. When opening the client, I get the Message: "mysql: [Warning] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe: ignoring option '--no-beep' due to invalid value ''." I also tried to connect over the MySQL Workbench, which doesn't work either.
Workbench error:

Using pythonanywhere's MySQL DB in python

I've created a MySQL DB on pythonanywhere.com. Now I'm writing a python script on my local PC trying to connect to it, but can't establish a connection.
import pyodbc
with pyodbc.connect(DRIVER="{MySQL ODBC 8.0 Unicode Driver}",
SERVER="******.mysql.pythonanywhere-services.com",
DATABASE="******$default",
USER="******",
PASSWORD="******",
OPTION="3") as conn:
cursor = conn.cursor()
Same with this connection string format:
pyodbc.connect("""DRIVER={MySQL ODBC 8.0 Unicode Driver};SERVER=******.mysql.pythonanywhere-services.com;DATABASE=******$default;USER=******;PASSWORD=******""")
****** = censored username and password
It returns this error:
pyodbc.Error: ('HY000', "[HY000] [MySQL][ODBC 8.0(w) Driver]Can't connect to > MySQL server on '******.mysql.pythonanywhere-services.com' (10060) (2003) (SQLDriverConnect); [HY000] [MySQL][ODBC 8.0(w) Driver]Can't connect to MySQL > server on '******.mysql.pythonanywhere-services.com' (10060) (2003)")
The official documentation doesn't seem to tackle this problem. It only mentions the library mysqlclient but I can't find out what it's purpose is.
Edit: It's only possible via ssh/paid account Accessing your MySQL database from outside PythonAnywhere
Found the answer on the site. It's only possible via ssh/paid account Accessing your MySQL database from outside PythonAnywhere

SQLCMD utility : connection to second instance does not work

I have only SQLCMD utility installed locally and want connect to MSSQL instance, but it seems the tool cannot parse the instance name
example:
sqlcmd -S SERVER\INSTANCE -U sa -P password
However, I can use this command from the machine where SQL Server is already installed.
Error message:
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : SQL Server Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF]..
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..
To use SQLCMD to connect to a remote server instance use the full URI of your server over the network like so;
sqlcmd -S FULLSERVERURI\INSTANCE -U sa -P password
for example, if you had your server at 'someplace.com', your connection would be
sqlcmd -S someplace.com\INSTANCE -U sa -P password
The machine/server would need to have port 1433 open. Consider your network security options.
Please make sure you enable TCP/IP Protocol. This is different from allowing network connections in the server properties.
This is a MSSQL 2012 example, but I have it tested on MSSQL 2017 Developer (full) and still works the same (and also, fails just the same when disabled)

mySQL command line works but ODBC and workbench do not

I am trying to test a connection to a mySQL database running on a remote linux server. I am running Windows 7 and have mySQL installed on my machine as well as the 32-bit ODBC driver. I can connect from the DOS command prompt with no problems. But I cannot connect using mySQL workbench or with ODBC (from MS Access).
In MySQL workbench my error is:
Your connection attempt failed for user 'username' from your host to server at 'x.x.x.x:x': Unknown MySQL server host 'x.x.x.x' (0)
In MS Acess (ODBC driver) my error is:
Connection faile:[HY000][MySQL][ODBC 5.2(w) Driver]Can't connect to MySQL server on 'x.x.x.x' (10061)
I've searched stackoverflow extensively and I found lots of people who can't get ANY connection to work. But I know I can log in from my computer. Could it be something other than ports?
Please make sure you are using correct ip address in MySQL workbench to connect to your mysql database