I'm trying to connect to mysql database from C#, but I have no idea how to get the connecttion string, since ubuntu is not like mssql has a visual UI. I have install phpmyadmin on ubuntu server already
-
take a look here on how to connect to different types of databases hopefully this will help Connection StringsMethodMan– MethodMan2014-12-02 14:40:02 +00:00Commented Dec 2, 2014 at 14:40
-
connectionstrings.com/mysqlRenatas M.– Renatas M.2014-12-02 14:40:09 +00:00Commented Dec 2, 2014 at 14:40
-
Thank You for your both answersRain– Rain2014-12-02 14:44:36 +00:00Commented Dec 2, 2014 at 14:44
-
But I'm not sure about the Server=myServerAddress. Does it mean my IP?Rain– Rain2014-12-02 14:45:43 +00:00Commented Dec 2, 2014 at 14:45
Add a comment
|
1 Answer
it should looks like this
var str="Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword";
var connection = new MySqlConnection(str);
myServerAddress is the Ip of your server
Database is the name of your Databas
Uid is the username of the user that you want to use to authenticate to the database
7 Comments
Rain
Thank you for your answer, But i'm not sure what should I put in the "Server=myserveraddress"
faby
the ip of your server e.g. 172.12.7.xxx
James T
@Rain it would be the server address, if its a local server this would be
127.0.0.1 or localhost. Otherwise its the IP of the host server.Rain
One more question, when I was searching youtube video online, I see some people put in the port 3306 too, what is that for?
faby
The port 3306 is the default MySql port, generally you should specify that, it depends on your server
|