What is the correct connection string to MariaDB which is on Synology?

Takeshi 41 Reputation points
2024-02-15T14:12:13.1333333+00:00

Hi all, I am trying to connect from my PC to MariaDB which is installed on Synology. Both device are connected to same WIFI. What I am doing wrong. Thanks. Till now I tried this:

using MySql; 
using MySql.Data.MySqlClient; 
string conString = "server=192.168.100.53:3307/run/mysqld;userid=root;password=password;database=test"; 
try 
{ 
	using (MySqlConnection con = new MySqlConnection(conString))
	{ 
		con.Open(); 
		Console.WriteLine("OK"); 
	} 
} 
catch(Exception ex) 
{ 
	Console.WriteLine("NOT OK : \n" + ex.Message); 
}
Developer technologies C#
0 comments No comments
{count} votes

Accepted answer
  1. Hui Liu-MSFT 48,676 Reputation points Microsoft External Staff
    2024-02-16T08:03:41.6566667+00:00

    Hi,@Takeshi.Welcome to Microsoft Q&A.

    Your connection string appears to have a couple of issues.

    You could try the following string.

    
       string conString = "Server=192.168.100.53;Port=3307;Database=test;Uid=root;Pwd=password;";
    
    //or
    
     string conString = "Server=192.168.100.53;Port=3307;Database=test;User ID=root;Password=password;";
    
    

    Added Port=3307 to specify the port number. By default, MySQL/MariaDB uses port 3306, but if your MariaDB instance is configured to use port 3307, you need to specify it explicitly.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    2 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.