Koozali.org: home of the SME Server

mySQL not accepting remote connections

Mike

mySQL not accepting remote connections
« on: May 26, 2003, 09:35:28 PM »
I'm developing a Java servlet that uses the mySQL connector with JDBC to connect to a mySQL database running on my SME server. When the servlet attempts to create a connection, an IO exception occurs:

Communication link failure: java.io.IOException, underlying cause: Unexpected end of input stream

** BEGIN NESTED EXCEPTION **

java.io.IOException
MESSAGE: Unexpected end of input stream

STACKTRACE:

java.io.IOException: Unexpected end of input stream
        at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:1096)
        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:387)
        at com.mysql.jdbc.Connection.createNewIO(Connection.java:1562)
        at com.mysql.jdbc.Connection.(Connection.java:491)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:346)
        at java.sql.DriverManager.getConnection(DriverManager.java:512)
        at java.sql.DriverManager.getConnection(DriverManager.java:171)


I read on the mySQL mailing list archives that this can occur if mySQL is configured to not accept remote connections via TCP/IP.

By default, is mySQL on SME configured to refuse remote connections? The machine that is running Tomcat and hence the servlet is inside my SME network (local).

Many thanks

Jochen Hoegerl

Re: mySQL not accepting remote connections
« Reply #1 on: May 27, 2003, 09:11:59 PM »
> By default, is mySQL on SME configured to refuse remote connections?

yes, normally only xxxxx@localhost is allowed.

Install phpmyadmin (from contribs.org) and you get a WebGUI to manage
mySQL to allow remote connections or whatever you want.

hope this helps

jochen

Mike

Re: mySQL not accepting remote connections
« Reply #2 on: May 27, 2003, 09:21:53 PM »
What exactly has to be changed? If you mean allowing users access from other hosts, then I've already tried that but it didn't make any difference.

I am already using phpMyAdmin.

Thanks

Guck Puppy

Re: mySQL not accepting remote connections
« Reply #3 on: May 27, 2003, 09:41:54 PM »
When you say "remote" do you mean other hosts on the local network or hosts on the internet?

By default it looks like the firewall closes the Mysql port on the net side. Portopening contrib should take care of that if you really need to open it up.

G

Mike

Re: mySQL not accepting remote connections
« Reply #4 on: May 27, 2003, 10:30:58 PM »
Other hosts on the local network.

Thanks

Steve

Re: mySQL not accepting remote connections
« Reply #5 on: May 27, 2003, 11:19:41 PM »
Are u running 5.6 ? Have you searched the forum.

Guck Puppy

Re: mySQL not accepting remote connections
« Reply #6 on: May 27, 2003, 11:24:10 PM »
Mike wrote:
>
> What exactly has to be changed? If you mean allowing users
> access from other hosts, then I've already tried that but it
> didn't make any difference.
>
> I am already using phpMyAdmin.

Then when you look in the "Users" section from your phpmyadmin homepage, you should see a table with headers :

Action     Host     User     Password     Privileges

looking down the "host" column, "%" means "any host". If the user you are attempting to connect as from a LAN host isn't allowed to access from anything other than "localhost" you won't be able to connect.

You can either  "Add a new User" and specify the host you'll be connecting from and assign privileges to the appropriate databases, or edit the user to allow access from any host "%" and let the firewall stop access from outside your LAN.

G

Mike

Re: mySQL not accepting remote connections
« Reply #7 on: May 27, 2003, 11:28:47 PM »
I already tried this, but I couldn't get a winning combination.

Thanks again

Mike

Re: mySQL not accepting remote connections
« Reply #8 on: May 27, 2003, 11:32:07 PM »
Yes I'm using 5.6 and yes I searched, but I couldn't find a relevant answer.

Thanks for replying.

Steve

Re: mySQL not accepting remote connections
« Reply #9 on: May 27, 2003, 11:35:30 PM »

Mike

Re: mySQL not accepting remote connections
« Reply #10 on: May 27, 2003, 11:44:26 PM »
Oops, guess I missed that one while browsing the list of search results.

Thanks

Bertrand CHERRIER

Re: mySQL not accepting remote connections
« Reply #11 on: May 28, 2003, 02:30:20 AM »
If you are running SME 5.6 U4, then check your MySQL version ...
I had to upgrade to mysql-3.23.54a-3.73 because of remote connexion problems using odbc. You will need to upgrade those packages as well :
glibc-2.2.5-42.i386.rpm         mysqlclient9-3.23.22-8.i386.rpm
glibc-common-2.2.5-42.i386.rpm  mysql-devel-3.23.54a-3.73.i386.rpm
libpng-1.0.14-0.7x.4.i386.rpm   mysql-server-3.23.54a-3.73.i386.rpm
libstdc++-2.96-113.i386.rpm

You can find them all on rpmfind.net

hope this helps

Mike

Re: mySQL not accepting remote connections
« Reply #12 on: May 28, 2003, 11:59:23 PM »
I see - thanks Bertrand.

Mike

Re: mySQL not accepting remote connections
« Reply #13 on: May 30, 2003, 07:23:24 PM »
I'm using version mysql-3.23.49-3 of mySQL.

I daren't upgrade those libraries, in case break something on the server and have to re-install. I have too many files saved on there and I'm not that brave!

Thanks

Bertrand CHERRIER

Re: mySQL not accepting remote connections
« Reply #14 on: May 30, 2003, 07:35:59 PM »
You could try a backup ... if you're that scared !
I did it on 4 different servers, and they were all with in production, with intranet systems running, but all of them needed to be connected through ODBC.
Everything went just fine.
These upgraded packages are from Red Hat, and as far as I know, the e-smith team are using them with no modifications.

Now it's up to you.

PS: If you can you could first try it on a non productive server.