Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • Set up remote access to MySQL database on Ubuntu

    • 0
    • 1
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 514
    Comment on it

    Without database any application is almost redundant. So this post might help you to setup access to MySQL database on Ubuntu.

    Firstly you need to open up the MySQL server config file present at


    and search for the line

    bind-address =

    Note - Always take backup of the file you are changing and use nano editor by typing the following command

    sudo nano my.conf

    It will ask for password. Enter the password and the file will open up.

    The line bind-address = actually binds MySQL connections to localhost only.

    Comment out this line by adding # at the front of this line

    After commenting out the line it should look like this

    #bind-address =

    Now save this file and restart MySQL by

    mysql restart 

    You are all good to go but this only enables MySQL access on local network

    If you want to access MySQL from a remote ip address then the following procedure will help you

    Before granting user access, you need to login to MySQL from SSH:

    $ mysql -u root -p 

    Enter the password when prompted. It is the same password which was specified during MySQL installation.

    Grant user access


      You have a database called TEST
      You would like to allow remote access to this database from a IP address
      The MySQL username is MY_USERNAME and the password is MY_PASSWORD

    Change the IP address, database name, username and password according to yours.

    To grant remote access, type the following command from MySQL prompt:


    On successful execution you see a message saying something like Query OK, 0 rows affected (0.00 sec)

    Restart MySQL by firstly quitting MySQL:

    mysql> quit 

    Then type the following command at the SSH prompt:

    mysql restart 

    Now you can access MySQL remotely through the ip you granted access to.

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: