0

When I was connecting to the database I always used "localhost" as a host name. Now I want to connect to my MYSQL database from Windows program and I have to use the real IP instead of localhost.

I tried to use the server IP and IP from this:

SHOW VARIABLES WHERE Variable_name = 'hostname'

But both don't work. How can I check the real IP adress, which can be used to connect to MYSQL DB?

MYSQL database was installed on my Debian server without any special settings I think.

allin0n3
  • 157
  • 1
  • 4
  • 13

1 Answers1

0

Check the user table in MySQL.

select user, host from mysql.user;

Check either they have privileges to connect remotely or not.
Also check bind-address in configuration file, it has to be commented.

khalid
  • 175
  • 5
  • 15
  • After using this command I got 127.0.0.1, localhost and my server IP. Nothing else. How can I check the privileges to connect remotely? – allin0n3 Sep 29 '16 at 16:10
  • Is that you want to connect from dynamic IP or static IP – khalid Sep 29 '16 at 16:12
  • If you want to connect from dynamic IP then you need to set the host to % – khalid Sep 29 '16 at 16:15
  • I set the host to % for user "lo" - in my case. But still I can't connect to the database. When I run your command, this % exists for this username. – allin0n3 Sep 29 '16 at 16:21
  • Connection failed: Can't connect to MySQL server on 'my_server_ip' (111) I've found the error. You were right. I did this: http://stackoverflow.com/questions/1420839/cant-connect-to-mysql-server-error-111 Problem solved. – allin0n3 Sep 29 '16 at 16:32