✅ Microsoft sql unable to connect. What I'm missing?
Hey!
Does anybody know what I'm missing as I'm trying to connect to mysql?
I get InvalidOperationExpection on SqlConnection.Open() function call. (
System.InvalidOperationException: 'Internal connection fatal error.
)
Here is the ConnectionString: Data Source = "127.0.0.1, 3307"; Initial Catalog = mysql_db; User ID = root; Password = root
Ip, port, db, username and password is correct as I was able to login as root use using MySQL Workbench software.
GetBuilder function:
GetConnection function
SendQuery function calls GetConnection after connection.Open is called which gives me the error.
25 Replies
SqlConnection
can't be used with MySQLWait, really?
you will need to get a mysql connector library
yes
all sql servers have their own protocol
SqlConnection
only works with MSSQL (Microsoft SQL Server) and ExpressI see. I was wondering why the hell my code is not working. This explains everything. Thank you!
https://www.nuget.org/packages/MySqlConnector/ should be what you need
MySqlConnector 2.3.7
A truly async MySQL ADO.NET provider, supporting MySQL Server, MariaDB, Amazon Aurora, Azure Database for MySQL, Google Cloud SQL, and more.
@Pobiega Do you know why it tries to connect to 172.18.0.0.1 instead of 127.0.0.1?
Connection string on top, and on Error it says 172.18.0.1
Unknown User•7mo ago
Message Not Public
Sign In & Join Server To View
But I don't really understand why it changes ip address to private from local.. This is something totally new to me
Unknown User•7mo ago
Message Not Public
Sign In & Join Server To View
But I don't get why access is denied. I have full access on MySql Workbench with same username
Unknown User•7mo ago
Message Not Public
Sign In & Join Server To View
password
?
I used docker to set up mysql
I can't really see what part is wrong..
Unknown User•7mo ago
Message Not Public
Sign In & Join Server To View
ahh, I totally forgot that it can be different on different sql..
I used
;
before (https://www.connectionstrings.com/sql-server-2008/) and after that I used ,
SQL Server 2008 connection strings - ConnectionStrings.com
Connection strings for SQL Server 2008. Connect using Microsoft.Data.SqlClient, SqlConnection, SQLNCLI11 OLEDB, SQLNCLI10 OLEDB, ODBC Driver 17 for SQL Server.
MSSQL uses the comma, but mysql seems to prefer
Port
in general, avoid mysql - its not a very alternative these daysI tried to get MSSQL to work with docker but no success, so I moved to mysql.
curious
i run mssql on docker myself and it works very well
I'm new to this all, so I probably failed to write working docker-compose.yml. I also tried to google and felt like I found decent answers, but no success
thats my docker-compose
or well, the sql service part of it 🙂
I found something similar, but it kept shutting down. Let me try again.
Yeah same issue, running for like 10 seconds then shutting down :S
try checking the logs?
ohh, such a stupid error..
Edit, seems like that is not all :S
Got it to work.
Thank you so much @Pobiega !
SQL Server password policy requirements because it is too short
...
Unknown User•7mo ago
Message Not Public
Sign In & Join Server To View
If you have no further questions, please use /close to mark the forum thread as answered