C # MySql Connection Error

0

I'm doing a project in C # but when I try to make the connection to the database it does not open and it generates the next error

this is my code

private void Form1_Load(object sender, EventArgs e)
    {
        try
        {
            MySqlConnection conexion = new MySqlConnection("Server=10.0.0.9; Port=3308; Database= baseprincipal; Uid=root; Pwd=; ");
            conexion.Open();
        }
        catch (Exception ex)
        {

            MessageBox.Show( this,ex.Message,"error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
    }
    
asked by JOSE ANGEL RAMIREZ HERNANDEZ 23.01.2018 в 21:01
source

1 answer

1

Give the user permission to connect remotely;

  

GRANT ALL PRIVILEGES on . TO 'root' @ '%' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;   FLUSH PRIVILEGES;

    
answered by 25.01.2018 / 02:31
source