Can't connect to mySQL localhost server

Issue

I have 2 computers on my LAN. 1 is a Linux Ubuntu server with mySQL installed that I am attempting to remotely connect to via mySQL workbench from my other computer, a windows PC. I have already created a dba user account pointing towards my windows IP to allow remote log in, given privileges and flushed them, ect… But I am getting the error "Unable to connect to localhost" when trying to make the connection. Some things I’ve considered… Because both computers are on my LAN I believe I do not need to edit the mysqld.cnf file’s bind-address. I’ve tried changing the "hostname" section on workbench to 127.0.0.1, the IPv4 of the Linux server, and the name of the Linux server all giving the same error. Do I possibly need to install mySQL on the Windows PC even though I already have workbench? Do I need to change my windows PC network settings to ‘private’ rather than ‘public’? That seems unlikely since they’re already localhost anyways. Do I need to port forward my mySQL? Again seems unlikely because it’s just a localhost connection. Do I need to make both computers have static IP’s? Although since I haven’t turned either of them off the IP’s have not been changed by DHCP so I believe that shouldn’t matter for the initial connection attempt. Any ideas?

Solution

127.0.0.1 "localhost" refers to literally that – the local host, and is never going to work to address one machine to another. if your computers are networked together they should have another IP probably starting with 192.168, 10., or 172.. No, you don’t need static IPs ; chances are on a home network they will not change. You need to make sure mysql is listening on an address other than localhost / 127.0.0.1 – very likely you will need to change the bind-address. 0.0.0.0 is a fine choice here for controlled networks. I don’t believe windows networking settings are relevant

Answered By – erik258

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published