mysql - Can not connect to secure phpmyadmin through my c# code -
i can not open new connection through code digitalocean server.. it's first account , first online database program.. here's did after creating account on digitalocean i've created droplet , installed lamp , secure phpmyadmin following installation tutorials..
i've given ipv4 address: xx.xxx.xx.xxx
when typein xx.xxx.xx.xxx/phpmyadmin browser asks username , password, comes phpmyadmin screen asks username root , it's password
i've created new database= testapp , users table..
and made basic program via c#, have textbox , button , code follows:
string constring = "server=xxx.xxx.xxx.xx;database=testapp;uid=root;pwd=_______"; mysqlconnection newcon = new mysqlconnection(constring); string insertcommand = "insert testapp.users(isim) values (?isim)"; mysqlcommand cmd = new mysqlcommand(insertcommand, newcon); newcon.open(); cmd.parameters.add("?isim", txtpost.text); cmd.executenonquery(); newcon.close();
when run program gives following error:
an unhandled exception of type 'mysql.data.mysqlclient.mysqlexception' occurred in mysql.data.dll
additional information: unable connect of specified mysql hosts.
how solve issue?
i don't know digitalocean, assuming virual server has been configured allow web traffic (i.e. ports 80 , 443, why phpmyadmin works).
your c# code (is it's not on server itself) need access mysql port default 3306. need find instructions on digitalocean opening up.
Comments
Post a Comment