Further on ... This may be a Unix/Linux problem Re: Unable to connect to any of the specified MySQL hosts
Hi,
After looking at the documentation specifically the help file I tried another way within unix to connect to the MySql server.
What I did was to copy the example given in the help file distributed with MySql.Data.dlll which is:
MySqlConnection myConnection = new MySqlConnection();
myConnection.ConnectionString = "database=myDB;server=/var/lib/mysql/mysql.sock;user id=myUser; pwd=myPass";
myConnection.Open();
In my case I found that I needed to change server to /var/run/mysqld/mysqld/mysql.sock as can be seen from:
andromeda:/var/run/mysqld# ls
mysqld.pid mysqld.sock
So in the end my code looked like:
MySql.Data.MySqlClient.MySqlConnection myConnection;
myConnection = new MySql.Data.MySqlClient.MySqlConnection();
myConnection.ConnectionString = "database=test;server=/var/run/mysqld/mysqld.sock;user id=mytest; pwd=mytest;";
myConnection.Open();
myConnection.Close();
Which except for the specifics for my connection now seems the same as the code example in the help file.
But the following is the series of error messages I get when trying to run it.
Unhandled Exception: MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts ---> System.PlatformNotSupportedException: Unix sockets are only supported on this platform
in <0x0002b> MySql.Data.Common.StreamCreator:CreateUnixSocketStream ()
in <0x000b4> MySql.Data.Common.StreamCreator:GetStream (int)
in <0x001f5> MySql.Data.MySqlClient.NativeDriver:Open ()
--- End of inner exception stack trace ---
in <0x00242> MySql.Data.MySqlClient.NativeDriver:Open ()
in <0x00033> MySql.Data.MySqlClient.Driver:Create (MySql.Data.MySqlClient.MySqlConnectionString)
in <0x000c6> MySql.Data.MySqlClient.MySqlPool:CreateNewPooledConnection ()
in <0x0022f> MySql.Data.MySqlClient.MySqlPool:GetPooledConnection ()
in <0x0004e> MySql.Data.MySqlClient.MySqlPool:GetConnection ()
in <0x00124> MySql.Data.MySqlClient.MySqlPoolManager:GetConnection (MySql.Data.MySqlClient.MySqlConnectionString)
in <0x00078> MySql.Data.MySqlClient.MySqlConnection:Open ()
Now I have tried to add in the protocol=unix parameter but that doesn't seem to help. that is I get the same error message.
Any thoughts??
-Joshua
Subject
Written By
Posted
November 17, 2004 02:28PM
Further on ... This may be a Unix/Linux problem Re: Unable to connect to any of the specified MySQL hosts
November 18, 2004 11:31AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.