1

I have a mysql database and I fetch it via a domain like www.mydomain-database.com. this domain is given by a company for accessing my database by phpmyadmin. When I browse this domain, it fetches phpmyadmin login page.

I try to connect to this database by the following code:

db = mysql.connector.connect(
        host = "www.mydomain-database.com",
        user = "root",
        passwd = "**",
        database = "database",
        charset = 'utf8', use_unicode=True
    )

When I run this, I get the following exept:

Can't connect to MySQL server on 'https://www.mydomain-database.com:3306' (-2 Name or service not known)

As you can see, connector adds port 3306 to my host; but the url with this port is not valid & it doesn't fetch the phpmyadmin!

So, for canceling that change, I added the port = "" as an argument for my connection but I got another error that mentioned the port must be integer!

Now the question is, how can I remove that port number when connector tries to connect the host?

0

1 Answer 1

1

You have to supply a port. By default MySQL uses port 3306. If your MySQL instance is using a different port, then you can specify that port in the settings.

Do you have access to the MySQL instance? If so you can try and run:

mysql> SHOW GLOBAL VARIABLES LIKE 'PORT';

to get your port number.

However, your error message refers to server https:// that is not normal, there should not be any reference to https://

Can you check your code in your app and make sure that

        host = "www.mydomain-database.com"

and not

        host = "https://www.mydomain-database.com"
Sign up to request clarification or add additional context in comments.

Comments

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.