How to connect my c# application to my phpmyadmin database from my NAS?

BgnerNprg207 286 Reputation points

Good day, I want to try to connect to my database in my NAS.

Please take a look the image below.


As you can see at the image, I want to access my database outside in my home network.

I already installed phpmyadmin in my NAS, but the problem is I don't know how to access it.

I watch a lot of tutorial videos, but no one can fix my problem.

I try it in my own and this my error.

User's image

and here my codes

//for nas db

string mysqlcon = "SERVER=192.X.X.X;" +

"PORT=3306;" +


"UID=root;" +


MySqlConnection mysqlconnection = new MySqlConnection(mysqlcon);




label2.ForeColor = System.Drawing.Color.Green;

label2.Text = "Connected";


catch (Exception ex)


label2.ForeColor = System.Drawing.Color.Red;

label2.Text = ex.Message;






the server address is my NAS ip address.

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,536 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Azizkhon Ishankhonov 355 Reputation points


    It seems that your IP address is the local address and depending on your requirements solutions may differ.
    A. Short-term solutions, which expose your localhost to the internet:

    1. dev tunnels:
    2. ngrok:

    B. The Long-term solution will be to deploy your database on the server via any provider

    0 comments No comments

  2. Bruce ( 59,546 Reputation points

    while a vpn solution is preferred. to open your database to the internet, you need to configure your router to do a incoming nat translation on a given port to the database server. see you router docs. you also need a static ipaddress from your ISP (this is usually an additional option). while you can use a what's my ipaddress to get your global ipaddress, it may not be unique but shared by other ISP users.

    0 comments No comments

  3. Olaf Helper 42,576 Reputation points

    I already installed phpmyadmin in my NAS

    phpmyadmin is just a tool, not a database engine.

    And it's for MySQL, not for Microsoft SQL Server; so wrong forum =>

    0 comments No comments

  4. BgnerNprg207 286 Reputation points

    Good day to all master!

    Thank you for your comments and suggestion, I finally fix this error.,

    Thank so much too the following,

    Azizkhon Ishankhonov, Bruce (, Olaf Helper

    0 comments No comments