Problem of connection

  • 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

    MySQLConnection con = new MySQLConnection( new MySQLConnectionString( "","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.


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

    • charles candy

      charles candy - 2003-06-10

      first of all you need to make sure u can access(no connectivity problem) from mysql client to mysql server. for how to establise conection please read the mysql manual

    • Robert Hammond

      Robert Hammond - 2003-07-11

      I have this same problem.  I have verified that I have the correct permissions.  Connection works from the command line mysql and from MySQL Control Center, both using the exact same info as my connection string.  Has anyone figured this out?

    • Frode Lillerud

      Frode Lillerud - 2003-12-30

      Same problem here!

      I tried this code:
      MySQLConnection con; con = new MySQLConnection( new MySQLConnectionString("","database","user","pwd").AsString );

      but get an exeption saying:
      Error: can't connect.Access denied for user:'root@', etc.

      The strange this is that I'm trying to connect to, but it reports back (localhost).

      Seems to me like MySQLDriverCS has a problem working with remote MySQL servers.

    • Bryce Kahle

      Bryce Kahle - 2004-01-03

      I posted this on the other post as well, but the root user is setup by default to only be allowed to connect from localhost. You can create other users to access the MySQL server from anywhere using the % wildcard character in the host field.

    • Bryce Kahle

      Bryce Kahle - 2004-01-03

      The reason it is reporting access denied for user: 'root@' is because users in MySQL are a combination of the username, and the hostname or IP address they are connecting from. When you create users in MySQL you can limit where they can connect from using the GRANT command.

      lookup the GRANT command on to learn more about creating users in MySQL.


Log in to post a comment.