0

I am trying to connect Visual Studio(C#) to MySql database(phpmyadmin using WAMP).

I am getting this error : Why am I getting "Cannot Connect to Server - A network-related or instance-specific error"?

Because I am using phpmyadmin, I installed SSMS to configure SQL Server Services(which can be solution to my problem), but when I try to find server name in phpmyadmin as sql query : SELECT @@SERVICENAME, I am getting another error: MySQL said: Documentation

1193 - Unknown system variable 'SERVERNAME'.

Can You help me to fix this issue ?

Community
  • 1
  • 1
mike_cus
  • 67
  • 1
  • 10
  • Go to youtube and see how connect to mysql db from c# –  Mar 09 '17 at 22:40
  • You need install .net mysql connector first –  Mar 09 '17 at 22:41
  • @Breakermind I already have connector. I would like to know first, why this query wont work ? – mike_cus Mar 09 '17 at 22:44
  • From mysql page https://dev.mysql.com/downloads/connector/net/ –  Mar 09 '17 at 22:44
  • Variable does not exist in mysql propably –  Mar 09 '17 at 22:45
  • @Breakermind thanks for effort. i suggest writing possible solution in one post. missing connector could be an answer, but 'variable doesnt exist' after I writing 'unknown system variable', more look like mean answer, than help. anyway thanks. – mike_cus Mar 11 '17 at 16:06

1 Answers1

1

If I'm not mistaken, you are trying to connect to MySQL using SQL Server Management Studio(SSMS)? You can't connect a MySQL database using SSMS.

For MySQL, you can use MySQL Workbench or you can check this link

The SELECT @@SERVICENAME, @@SERVERNAME is a built-in function used by SQL Server not MySQL.

  • thank You! This clue led me to answer. I didnt know there is difference between Sql Server and MySql, so I just had to change SqlServerAdapter to MySqlServerAdapter. Btw, sorry for late response. – mike_cus Mar 11 '17 at 16:02