1

Good morning everyone,

I have a problem connecting to a SQL instance with python using mysql connector. The complete server adress / host name looks like "MSQL\INST1" and I can connect to it through Excel without any problem.

If I try mysql.connector.connect(host="MSQL\INST1", user=" Report", passwd="123", db="abc") I get: MySQLInterfaceError: Unknown MySQL server host 'MSQL\INST1' (11)

And if I try it without the instance: mysql.connector.connect(host="MSQL", user=" Report", passwd="123", db="abc") I get: MySQLInterfaceError: Can't connect to MySQL server on 'MSQL' (10061)

Do I miss something? In every tutorial I found the host name is without any instance...

Best regards, Joachim

5
  • 1
    Wait, are you trying to connect to SQL Server or to MySql? Commented Mar 8, 2019 at 8:30
  • I want to connect to a MS SQL Server. I think I read yesterday that this should work with the mysql connector. But now it looks like I have to use another python module? Commented Mar 8, 2019 at 8:42
  • Yeah, MySql and Sql Server are two different database systems. Commented Mar 8, 2019 at 8:45
  • However, take a look there: stackoverflow.com/questions/2314178/python-sql-server Commented Mar 8, 2019 at 8:46
  • Thanks! I tried pyodbc, but didn't get it to work. Then I tried pymssql and it worked right from the beginning. :-) Commented Mar 8, 2019 at 9:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.