Difference between revisions of "MySQL: Mengijinkan sambungan dari non-localhost"

From OnnoWiki
Jump to navigation Jump to search
Line 33: Line 33:
  
 
  max_connections        = 10000
 
  max_connections        = 10000
 +
 +
 +
 +
 +
==Edit database mysql di MySQL==
 +
 +
mysql -u root -p123456
 +
 +
use mysql
 +
 +
Lihat ijin akses
 +
 +
select User , Host from user;
 +
 +
+------------------+-----------+
 +
| User            | Host      |
 +
+------------------+-----------+
 +
| mediawiki        | %        |
 +
| root            | 127.0.0.1 |
 +
| root            | ::1      |
 +
| debian-sys-maint | localhost |
 +
| dvwa            | localhost |
 +
| mediawiki        | localhost |
 +
| root            | localhost |
 +
| root            | wiki      |
 +
+------------------+-----------+

Revision as of 10:36, 15 February 2016

Agar sambungan dari non-localhost dapat dilakukan, kita perlu mengedit

vi /etc/mysql/my.cnf


Di bagian

[mysqld]

Tambahkan

skip-name-resolve
skip-networking


Default bind hanya dari localhost

bind-address            = 127.0.0.1

Ubah menjadi

bind-address            = ip.address.anda

Atau kalau mau mengijinkan sambungan dari semua IP address, ubah menjadi

bind-address            = 0.0.0.0

Ini sangat berbahaya, karena server mysql kita jadi gampang di hack


Agar bisa banyak di akses, set

max_connections        = 10000



Edit database mysql di MySQL

mysql -u root -p123456
use mysql

Lihat ijin akses

select User , Host from user;
+------------------+-----------+
| User             | Host      |
+------------------+-----------+
| mediawiki        | %         |
| root             | 127.0.0.1 |
| root             | ::1       |
| debian-sys-maint | localhost |
| dvwa             | localhost |
| mediawiki        | localhost |
| root             | localhost |
| root             | wiki      |
+------------------+-----------+