Problem connecting to a mysql database hosted on a server with C #

2

Problem C # and Mysql

My problem is that my application created in c # with the IDE Visual Studio 2017 sends me the following message:

  

unable to connect to any of the specified mysql hosts

This problem arose since I moved my local database to a web server, I already tried the remote access option in the Cpanel of the website but it just does not connect me.

My connection string is as follows:

servidor = "miServidor"; 
baseDatos = "miBaseDatos"; 
usuario = "miUsuario";
password = "miContraseña"; 
string cadenaConeccion; 
cadenaConeccion = "SERVER=" + servidor + ";" + "DATABASE=" + baseDatos + ";" 
                  + "UID=" + usuario + ";" + "PASSWORD=" + password + ";";
coneccion = new MySqlConnection(cadenaConeccion);

I already tried to connect using the workbench and it does not work either, disable the windows firewall and it does not work, I'm trying to connect from the pc where I'm running the cpanel I do not know if that has something to do.

Any suggestions on what my problem might be?

Thanks in advance.

    
asked by HeZu Jared 21.06.2017 в 07:49
source

2 answers

0

Apparently it was an error on the hosting page, I changed the provider and it worked correctly.

    
answered by 26.06.2017 / 05:23
source
1

try to give permissions to your user in the following way from your mySQL

GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'@'%' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;

Then bind to all addresses by commenting the following line in my.cnf

#bind-address = 127.0.0.1 

and restart the mysql service

service mysql restart
    
answered by 21.06.2017 в 09:36