Connecting to MySQL Server Across a Local Windows Network

To access MySQL Server over a local Windows network you will need to open up the port that MySQL is using and also grant privileges for the user that will access the database server.

Opening Your Server

To allow network access you need to open up the port that MySQL is using, normally 3306. This is achieved by modifying the Windows Firewall settings on the computer running MySQL:

  1. Open Windows Firewall.
  2. Select the Advanced tab.
  3. Under the network connection settings select Local Area Connection and then Settings.
  4. Select Add a new service.
  5. Name it something sensible like MySQL Server.
  6. Enter the IP address or computer name of the computer running MySQL.
  7. Specify the port number 3306 for both external and internal port numbers and select TCP.
    Windows Firewall Service Settings
  8. Confirm your settings.
  9. The new service should now be listed under services and selected. Now choose OK to exit each window that appears to save the changes.
    Local Area Network Settings

With the service created you should now be able to connect to the database from another machine on the network.

Grant User Privileges

Before you can gain access to the database user privileges will need to be granted for the user attempting to connect. Privileges are granted in the normal way but you need to specify the host the user is connecting from or use a wildcard. Using Command Prompt log on to your MySQL server and then execute the following command to specify a host:

grant all privileges on *.* to 'user'@'host' identified by 'password' with grant option;

or the following to use a wildcard:

grant all privileges on *.* to 'user'@'host' % by 'password' with grant option;

With these changes you should now be ready to go and be able to access the database server across a Windows local network.

This entry was posted in Programming and tagged , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.


  1. Fatal error: Uncaught Error: Call to undefined function ereg() in /home/brightfunction/ Stack trace: #0 /home/brightfunction/ thematic_commenter_link() #1 /home/brightfunction/ thematic_comments(Object(WP_Comment), Array, 1) #2 /home/brightfunction/ Walker_Comment->start_el('', Object(WP_Comment), 1, Array) #3 /home/brightfunction/ Walker->display_element(Object(WP_Comment), Array, '5', 0, Array, '') #4 /home/brightfunction/ Walker_Comment->display_element(Object(WP_Comment), Array, '5', 0, Array, '') #5 /home/brightfunction/ Walker->paged_walk(Arra in /home/brightfunction/ on line 175