mysqlwindowsdatabase-connection

How to make mySQL database at my local accessible from different machines?


I have mySQL installed at my Windows system which I connect using mySQL Query Browser. I am giving training and I want people to be able to connect to my machines SQL Database

How do I do that? Currently its not allowing the connections.

What settings do I need to modify?


Solution

  • STEP 1: Check IP connectivity

    By default it only allows connections from 127.0.0.1. Are you using windows or linux?

    Open my.cnf and change bind address to your network IP.

    [mysqld]
    user            = mysql
    pid-file        = /var/run/mysqld/mysqld.pid
    socket          = /var/run/mysqld/mysqld.sock
    port            = 3306
    basedir         = /usr
    datadir         = /var/lib/mysql
    tmpdir          = /tmp
    language        = /usr/share/mysql/English
    bind-address    = 127.0.0.1
    

    More info can easily be found in google, check this.

    STEP 2: Check your firewall

    Also, as commented by @Leandro, check your windows firewall settings to allow connections to happen.

    One easy way to test it is to make a telnet from the client machine to your MySQL network ip, port 3306 and see if connects or get blocked.

    STEP 3: Check mysql user permissions

    Once you have IP connectivity, the user that your alumni are using should have log in permissions from any host. For example if they use root you have to run a query like this:

    update user set host=’%’ where user=’root’ and host=’ubuntuserv’;
    

    You can see more info here.