Problem of connection

Cyril
2003-03-02
2004-01-03
  • Cyril
    Cyril
    2003-03-02

    Hy everybody,

    I have tried mysqldrivercs with C# and mysql database. It works but only if mysql is installed on the machine that's to say "localhost". When i connect, i use :
    MySQLConnection con = new MySQLConnection( new MySQLConnectionString( "localhost","test","root","").asString );

    But if i want to connect on server linux with Mysql, i can't, for this i change localhost by address IP of the server ; for example 192.168.0.5

    MySQLConnection con = new MySQLConnection( new MySQLConnectionString( "192.168.0.5","test","root","").asString );

    And it doesn't work, impossible to connect although Mysql server is ok, it runs fine but impossible to connect with C#. I also tried with mysql installed on a different pc with Windows and it doesn't work too.

    So, if anyone know to connect on a server with mysql, it would be great to share the answer.

    Thanks in advance.

    Bye
    DoooD

    PS : Excuse for my english, i'm french, sorry

     
    • Bryce Kahle
      Bryce Kahle
      2004-01-03

      The problem you are experiencing is not one that is a cause of C#. The default user that comes installed with MySQL is root with no password, but that user can only connect from localhost, thus why you can connect to a server on your machine, but no others.

      You need to add a user to mysql, using the mysql client.
      goto mysql.com and lookup the GRANT command.

      Make sure when you add the user to put '%' as the host. This is a wildcard character, and will allow you to connect from anymore.