1

I am trying to connect to my GearHost Database in python, I followed the instructions here on GearHost. My python code looks like:

from mysql.connector import connection

server = 'den1.mssql6.gear.host'
db = 'testmenow'
user = 'testmenow'
psword = 'TEST!!'

cnxn = connection.MySQLConnection(host=server, user=usr, password=psword, database=db)
cursor = cnxn.cursor()


cnxn.close()

I get the following error:

mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server on 'den1.mssql6.gear.host:3306' (10061 No connection could be made because the target machine actively refused it)

I have also tried to connect to GearHost through mysql workbench, as instructed in GearHost's instruction page, which also cannot connect to the database:

Connecting to MySQL server ... Can't connect to MySQL server on 'den1.mssql6.gear.host' (10060)

This is what my GearHost shows: enter image description here

Tried (unsuccessfully)

Question

Am I missing something obvious that is preventing me from connecting to GearHost, either with python or mysql workbench?

UPDATE as @SMor pointed out, I had mistaken MSSQL for MySQL - I was able to successfully connect to my database using:

import pyodbc

server = 'den1.mssql6.gear.host'
db = 'testmenow'
usr = 'testmenow'
psword = 'TEST!!'


cnxn = pyodbc.connect('DRIVER={ODBC Driver 13 for SQL Server};SERVER='+server+';'
                                                                              'DATABASE='+db+';UID='+usr+';PWD=' +  psword)
cursor = cnxn.cursor()
mdoc-2011
  • 2,747
  • 4
  • 21
  • 43
  • First off, MySQL and SQL Server are not the same thing. You will need to figure out which type of database server you are using first. Your first link suggests MySQL but the server name you are using does not follow the "pattern" that those instructions contain. Perhaps there is a "connecting to MS sql server" set of instructions? – SMor Jul 16 '18 at 20:44
  • 1
    OK, that wasn't difficult. There is a set of SQL Server instructions [here](https://www.gearhost.com/documentation/connect-to-a-mssql-database) – SMor Jul 16 '18 at 20:45
  • Thank you for pointing out my oversight here , I didn't notice it was MSSQL instead of MySQL. If you want to add it as an answer, I can accept it. – mdoc-2011 Jul 16 '18 at 21:00

0 Answers0