Hi All,
Don't know if this is the right forum for this query, but couldn't find anything more suitable.
I have written a new app in VB.net as a front end to a mySQL database held on a PC on the LAN running Windows XP. This worked fine for a while. The PC running the mySQL server started locking up (XP errors, not mySQL errors according to the event logs), so I decided to have a go installing Ubuntu to run the mySQL server to see if that was more stable.
Ubuntu 11.10 is now installed, and mysql server is also running. I have imported the old sql database files and the mySQL workbench shows all tables are imported successfully.

HOWEVER, I cannot get my VB application to connect to the database now it resides on Ubuntu - just returns "Unable to connect to any of the specified MySQL hosts" when i try to open a connection. I am fairly new to Ubuntu and MySQL, and don't know if the fault lies with the O/S (a firewall config problem perhaps?) or if I need to do something different with mySQL.
I can ping the Ubuntu pc from the client pc and vice versa.
I have used ufw to open port 3306 on the server
The ufw logs do not show any errors when I try to connect from the client pc, so I don't think it's a firewall problem (but could be wrong).
I thought it may be something to do with the usernames I use in the connection string, but when I change these (deliberately use the wrong password for example) I get the same message, rather than a username/password error

Is anyone else using a client PC running Windows (W7 or XP) to connect to a mySQL database running on a Ubuntu server?
All help gratefully received. (again - sorry if this is posted in wrong forum)

Toomutch

Recommended Answers

All 8 Replies

Is it a possibility you need to instal the mySQL adapter?

Here are the adapters available.

Do you mean I should install the adapter/connector on the client, or on the server?

On the client.

But you may also need to configure the mysql server to allow incoming connections to other than localhost.
In the permission table. (If I'm not mistaken).

Have installed fresh connector on the client (6.4.4 to 6.5.4), but no difference.
The username I have specified on the server has 'limit connectivity to hosts matching' set to % as I understood this means 'remote' - is this correct?

That is the wildcard character.

That means that you are allowing any connection from any IP.

Do you have a user setup (with access to the database) on the Ubuntu machine?

It might also be a good idea to specify the port in the connectionstring, even if it's the default one.
I found a bug report regarding that error message on MySql.com that suggested this could be the problem.

Thanks for the suggestion Oxiegen, I have added "port=3306" to the connection string, but no difference.

I have already added a user from the 'server administration' panel on the workbench, and have ticked the same boxes as when it was originally on the XP machine. I already had mysql installed on my dev laptop for testing, so I changed my connection string back to use the "127.0.0.1" IP address and this connects fine. I think that this proves that my VB Net coding is correct, and that my connection string is correct. It therefore points to the Ubuntu server as being the problem, so I did a bit more testing: if I remove the user from the Ubuntu server, (workbench, server administration, security, users and privileges - remove) and try to connect I still get the same message (i.e. Unable to connect to any of the specified MySQL hosts.) I don't get any username / password errors. Does this have any relevance?

did some more digging and eventually found the problem. In the /etc/mysql/my.cnf on the ubuntu server, the bind-address was set to 127.0.0.1 by default, so was only looking for connections from itself. I amended the file to 'bind-address = 0.0.0.0' and all is fine and dandy! Thanks for the suggestions from those who contributed - don't think I would have got there without you.

Toomutch

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.