简体   繁体   中英

how to connect c# windows form with remote mysql database

I want to connect my server pc MySQL database with client pcs. I make configurations in xampp server. PHPMyAdmin shares with fine in other client pcs. but I run my c# form it gets connection name error. this is my connectiondb class in c# form.

 public static MySqlConnection conString()
    {
        MySqlConnection conn = new MySqlConnection(@"server=http://192.168.8.102; userid=root; password=0713; database=pos_system; port=3306");
        return conn;
    }

I try to run my application using a client pc but it shows this name cannot find. how to fix my error. I also open firewall port 3306.

Your connection string format is not correct for MySql, try something like this:

var con = new MySqlConnection(@"Server=192.168.8.102;Port=3306;Database=pos_system;Uid=root;Pwd=0713;");

For more information check: https://www.connectionstrings.com/mysql/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM