Setting up Remote Access

From Hashmysql
Jump to: navigation, search

A lot of people come on the channel and ask for something like this: -> ERROR 2003: Can't connect to MySQL server on '192.168.1.102' (111)

Here's a couple of things you might want to take in considerations.

  • Are you on Gentoo ?
  • Are you on Debian ?
    • If you are on gentoo and you just emerged mysql-server, go into /etc/mysql/, and open the file my.cnf
      • You can browse thru it and around 85% of the file, you will see:
set-variable    = key_buffer=16M
set-variable    = max_allowed_packet=1M
set-variable    = thread_stack=128K
# keep secure by default!
bind-address    = 127.0.0.1
port            = 3306
# this can make it even more secure:
#skip-networking
      • Make sure you comment out
bind-address = 127.0.0.1
      • To finally make it look like:
set-variable    = key_buffer=16M
set-variable    = max_allowed_packet=1M
set-variable    = thread_stack=128K
# keep secure by default!
#bind-address    = 127.0.0.1
port            = 3306
# this can make it even more secure:
#skip-networking
      • Shutdown the mysql service, then restart it and it should work!





    • If you are on Debian
      • It looks a lot like Gentoo but, go into /etc/mysql and open the file my.cnf
...
tmpdir      = /tmp
language    = /usr/share/mysql/english
skip-locking
#
# The skip-networkin option will no longer be set via debconf menu.
# You have to manually change it if you want networking i.e. the server
# listening on port 3306. The default is "disable" - for security reasons.
skip-networking
key_buffer          = 16M
max_allowed_packet  = 1M
...
      • You should see something that looks like :
skip-networking
      • Well to make it quite simple.. just comment it so it looks like this.
...
tmpdir      = /tmp
language    = /usr/share/mysql/english
skip-locking
#
# The skip-networkin option will no longer be set via debconf menu.
# You have to manually change it if you want networking i.e. the server
# listening on port 3306. The default is "disable" - for security reasons.
#skip-networking
key_buffer          = 16M
max_allowed_packet  = 1M
...


And now please read under here ...

      • Execute the command /etc/init.d/mysql restart and you should now have access.





--CPUnerd 14:22, 21 Dec 2004 (CST)David.