Solusi "Cannot Connect to MYSQL server on "


Jika kamu pernah menginstall mysql server di ubuntu server dan ketika mau mengkoneksikan dengan jaringan lokal timbul error seperti diatas, maka kemungkinan setingan my.cnf nya belum benar.

Coba lakukan langkah langkah berikut:

Masuk ke /etc/mysql/my.cnf buka file tersebut dengan perintah "sudo pico /etc/mysql/my.cnf"

  1. Kemudian cari kata kata yang bernama "bind-address" yang berada di [mysqld].
  2. Edit kata kata tersebut menjadi "bind-address = 192.168.0.5" ganti ip address tersebut dengan ip address ubuntu server kamu
  3. Kemudian save.
  4. Restart mysqld dengan perintah "sudo /etc/init.d/mysql restart"
  5. di /etc/rc.local ditambahkan :
  6. # rc.local
    iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
    apache2 start
    exit 0

     

  7. Coba jalankan aplikasi di jaringan lokal anda yang terkoneksi ke mysql server
  8. Semoga berhasil...

#mysql -h 192.168.200.2 -u root -p

ERROR 2003 (HY000): Can’t connect to MySQL server on ’192.168.200.2′ (111)

1. Masuk server via ssh

#ssh -Y root@192.168.200.2

2. Edit file my.conf

#nano /etc/mysql/my.conf

3. Cari baris bind-address  = 127.0.0.1

4. Ganti dengan ip server

bind-adress =192.168.200.2

5. Disable firewall

#ufw disable
Firewall stopped and disabled on system startup

6. Restart mysql

#/etc/init.d/mysql restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mysql restart

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) and then start(8) utilities,
e.g. stop mysql ; start mysql. The restart(8) utility is also available.
mysql stop/waiting
mysql start/running, process 3117

7. Tes koneksi dari terminal client

#mysql -h 192.168.200.2 -u root -p
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 34
Server version: 5.1.54-1ubuntu4 (Ubuntu)

Alhamdulillah. MySQL bisa di remote dari luar.

palawa.wordpress.com

perintah2 mysql:

# ps aux | grep mysql
# mysql -h 127.0.0.1 -u root –p

# mysql -h 192.168.200.2 -u root –p

# netstat -lpnut | grep mysql
# netstat -l --numeric-ports | grep 3306

http://ubuntuforums.org/showthread.php?t=1625679
http://askubuntu.com/questions/79226/cant-connect-to-local-mysql-server-through-

socket-var-run-mysqld-mysqld-sock

# netstat -ln | grep mysql

# mysql -u username -p

# ps -e | grep mysql

List of all MySQL commands:
Note that all text commands must be first on line and end with ';'
?         (\?) Synonym for `help'.
clear     (\c) Clear the current input statement.
connect   (\r) Reconnect to the server. Optional arguments are db and host.
delimiter (\d) Set statement delimiter.
edit      (\e) Edit command with $EDITOR.
ego       (\G) Send command to mysql server, display result vertically.
exit      (\q) Exit mysql. Same as quit.
go        (\g) Send command to mysql server.
help      (\h) Display this help.
nopager   (\n) Disable pager, print to stdout.
notee     (\t) Don't write into outfile.
pager     (\P) Set PAGER [to_pager]. Print the query results via PAGER.
print     (\p) Print current command.
prompt    (\R) Change your mysql prompt.
quit      (\q) Quit mysql.
rehash    (\#) Rebuild completion hash.
source    (\.) Execute an SQL script file. Takes a file name as an argument.
status    (\s) Get status information from the server.
system    (\!) Execute a system shell command.
tee       (\T) Set outfile [to_outfile]. Append everything into given outfile.
use       (\u) Use another database. Takes database name as argument.
charset   (\C) Switch to another charset. Might be needed for processing binlog

with multi-byte charsets.
warnings  (\W) Show warnings after every statement.
nowarning (\w) Don't show warnings after every statement.

For server side help, type 'help contents'

Terima kasih telah membaca artikel tentang Solusi "Cannot Connect to MYSQL server on " di blog Tutorial Opensource and Linux jika anda ingin menyebar luaskan artikel ini di mohon untuk mencantumkan link sebagai Sumbernya, dan bila artikel ini bermanfaat silakan bookmark halaman ini di web browser anda, dengan cara menekan Ctrl + D pada tombol keyboard anda.

Artikel terbaru :