3

I have a MySql Server 5.7 running as service on one computer of a LAN.

My application is installed and running fine on the same computer. I have 'Shared with everyone' set for the directory where my application is located. In the same directory I have put the libmysql.dll and the FDConnectionDefs.ini files.

My application is running fine on that computer. On the other computers on the LAN I created a link to the directory where my application is shared. When I try to run my application from these LAN systems they produce the error message

[FireDac][Phys][mySql] can't connect to mySql server 127.0.0.1 on port 3306... (10061).

All machines are running Windows 10 on 64 bit processors.

Here what i've tried to resolve the problem:

  • make sure that the user, password and host (%) are the same in mySql Profile and FDConnectionDefs.ini.
  • I've tried with different users even with root, i've tried to change host (%) to put the IP address of the computer trying to connect in the mySql profile.
  • I make sure that i have permissions to run my application and mySql and that the port 3306 is open in the Firewall/Kaspersky on each computer of the LAN. But always the same error message.
R.Drolet
  • 39
  • 3
  • You may want to try formating your question. The wall of text that people will see is a little intimidating and hard to read (your English seems fine though). Maybe fix the title too. I'm not entirely sure what is means – Carcigenicate Nov 03 '16 at 14:11
  • Is your LAN IP actually 192.0.0.1? Unless you're an ISP you should not be using this address on a private network. – J... Nov 03 '16 at 14:24
  • Oupps! I mean 127.0.0.1 on port 3306. – R.Drolet Nov 03 '16 at 15:16
  • I wondered if perhaps that was the case... – J... Nov 03 '16 at 15:27

1 Answers1

3

127.0.0.1 is a special IP address - the "loopback" address that is typically resolved for localhost on most systems. It is a private internal IP address that a computer can use to refer to itself. It has no meaning to other systems on a LAN since every computer will recognize 127.0.0.1 as meaning itself.

This means that when you are running the application on a remote system it will be trying to connect to a MySQL server running locally rather than on a server elsewhere.

You'll need to configure your FireDac components to connect to the actual LAN IP address that belongs to the system hosting the MySQL server. You will probably also need to make sure that your MySQL users are set up to authenticate from an IP other than localhost.

J...
  • 30,968
  • 6
  • 66
  • 143
  • Very interesting and very clear! I'm going to test this tomorow. I'll be back! – R.Drolet Nov 04 '16 at 00:23
  • Hi there, I've just tried the solution but the error message change a little bit: [FireDac][Phys][mySql] can't connect to mySql server 67.70.76.128 on port 3306... (10060). – R.Drolet Nov 04 '16 at 16:33
  • I've changed the IP adress in FDConnectionDefs.ini file with the same result. I've changed the Host field in MySql profile user (% --> IP adress) with the same result. What I've observed is both computer have the same IP adress!!! I've got the IP adress with 'Whatismyip.com' on each computer. – R.Drolet Nov 04 '16 at 16:52
  • @R.Drolet You're trying to run before you can walk, here. If you're going to build a networked application then you will need to start by learning how networks work. Using a public web service like *Whatismyip.com* will return the public IP address (WAN address) that your ISP provides to whatever device connects you to the broader internet. Internally, however, you will have a router or switches, etc, that comprise your internal network (LAN) - each system will have a unique IP address on your LAN that is private. – J... Nov 04 '16 at 16:57
  • @R.Drolet This topic is much too broad to fit into a comment, in any case - in order of sequence you will need to 1) Learn the difference between WAN and LAN IPs, 2) Learn how to discover your LAN IP address, 3) Configure MySQL to serve and accept user connections over the LAN address, 4) Configure your FireDac components to use the LAN IP address of the MySQL server. If you get stuck, I suggest you ask each of these as a separate question. – J... Nov 04 '16 at 17:00
  • @R.Drolet I'm also presuming that you do not want to expose your MySQL server to the broader internet. If you've punched holes in your firewalls in trying to get this to work, and your MySQL server *is* configured to accept connections from the WAN address, then I also suggest that you undo this - having a public-facing SQL server is huge security risk, doubly so if you don't understand what those risks are. – J... Nov 04 '16 at 17:03
  • Again, very interesting and very clear! 1)With your comment above I can make the difference for my immediate need. 2)With CMD prompt and IPConfig I should be able to get the good LAN IP adress now, right? 3) and 4) I tought I was right in typing the LAN IP adress on the Server parameter in the FDConnectionDefs.ini file, am I? – R.Drolet Nov 04 '16 at 18:01
  • @R.Drolet Yes, also make sure your mysql user [has permission to connect](http://stackoverflow.com/a/38389851/327083) from their LAN IPs (ie with `%` or `192.168.0.0`, for example). You'll need to make sure that your MySQL server is also listening on the server's LAN IP (see [bind-address](http://dev.mysql.com/doc/refman/5.7/en/server-options.html#option_mysqld_bind-address)) – J... Nov 04 '16 at 18:25
  • Ok, I've just tried with 192.168.2.127 that is the LAN IP adress where MySql server is running and i did replace % with that LAN IP adress in the user profile and yes i'm using the same password both end. Again same error message but with the LAN IP adress. How do I make sure MySql server is listening on the server's LAN IP? – R.Drolet Nov 04 '16 at 19:01
  • I've just watched the log file and here what I saw: Timestamp, Thread, Type, Details 2016-11-04T19:13:26, 142, Note, Access denied for user 'root'@'localhost' (using password: NO). I'm not using user 'root' at all since yesterday! Where does it come from? – R.Drolet Nov 04 '16 at 19:12
  • @R.Drolet At this point, I think you need to start a new question. Provide all of the information you have and you'll probably get a better response now that your question is much more focused and specific. – J... Nov 04 '16 at 19:23
  • Ok, I will. BIG thanks for your help and patience! I've learn a lot with you and I really appreciate what you've done! Have a good day! – R.Drolet Nov 04 '16 at 19:32
  • 1
    It's working!!! You were right all the way. I mistyped one digit in the last step when typing LAN IP adress. After correction I had to type the computer's name in the User account 'From Host' field of MySql server and Bingo! Big thanks again!! – R.Drolet Nov 06 '16 at 02:33