Apparently, it is recommended that you use Connector/Net from MySQL to connect to MariaDB. I've never used MariaDB or even MySQL all that much but it looks like you use the same format for the connection string.
I have installed on my laptop MySql Connector two month ago and normally I have test to connect to localhost mysql that success using C# as interface and nothing found error.
with condition : attached references "MySQL.data" on Visual studio 2012. and server still only localhost(nothing need the internet line or needn't LAN IP)
Now the other situation, I have one server and there installed mariadb server(centOS 7) on LAN and there assigned IP for this server of course and also assigned IP for client.
in the meantime, Ping from client to server is good.
so when I use old code previously have test on localhost, The warning message I found , "unable to connect to any of the specified mysql host"
any idea for connection c# as interface to mariaDB server LAN
MySql.Data.MySqlClient.MySqlConnection cn = new MySql.Data.MySqlClient.MySqlConnection(); cn.ConnectionString = conn;
but with code above, I can't connect to server CentOS 7 "MariaDB Server". the message error unable connect to any mysql. and after i disable firewall on each machine, the error message is " authenticate for user ....."
- I have disable all firewall On client and server to take a look "connect or not"
- I used code with php as web application interface, the connection is established and success.
- VS 2012 C#, connector using mysql-connector net 6.8.3
- Connection only use LAN(peer to peer)
Why did you now change the equals (=) to a colon )? Show us the exact code you're using and tell us exactly what happens. If there's an exception thrown when you try to connect then give us the exact error message. Don't be vague because we only know what you tell us so you have to tell us everything that's relevant and precisely.
Here I display my code to use to connect to server CentOS 7. VS 2012 C# only Front End interface
using System;using System.Collections.Generic;
public partial class Form1 : Form
private void button1_Click(object sender, EventArgs e)
//String connectingstring = "Server=127.0.0.1;Port=3306;UID=root;PWD=123;Database=test";
//-> code previously above for using connect to localhost(PC of standalone) and there nothing problem , then connection was success full..
String connectingstring = "Server=192.168.0.2;Port=3306;UID=root;PWD=123;Database=test";
//--> this is I used to connect to Server MariaDB(CentOS) via LAN and could not to be connected.
MySqlConnection conn = new MySqlConnection(connectingstring);
catch (Exception ex)
-I have upgrade to mysql-connector net-6.9.3.
- VS 2012 C#
Solved..the problem came from on server mariadb configuration. from the first I could have imagine this problem come from my configure server mariadb on CentOS.
wrong configuration from server such as firewall configuration does not exact, privileges on mariadb server,that make connection could not be established.
So I think closed this thread.
anyway many thank to Mr. JohnH, Mr. jmcilhinney that their response.