Difference between revisions of "MySQL: Mengijinkan sambungan dari non-localhost"
Jump to navigation
Jump to search
Onnowpurbo (talk | contribs) |
Onnowpurbo (talk | contribs) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
vi /etc/mysql/my.cnf | vi /etc/mysql/my.cnf | ||
+ | |||
+ | |||
+ | Di bagian | ||
+ | |||
+ | [mysqld] | ||
+ | |||
+ | Tambahkan | ||
+ | |||
+ | skip-name-resolve | ||
+ | skip-networking | ||
+ | |||
Default bind hanya dari localhost | Default bind hanya dari localhost | ||
Line 22: | 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 | | ||
+ | +------------------+-----------+ | ||
+ | |||
+ | Update host dari user | ||
+ | |||
+ | UPDATE mysql.user SET host = {newhost} WHERE user = {youruser}; | ||
+ | UPDATE mysql.user SET host = % WHERE user = root; |
Latest revision as of 10:42, 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 | +------------------+-----------+
Update host dari user
UPDATE mysql.user SET host = {newhost} WHERE user = {youruser}; UPDATE mysql.user SET host = % WHERE user = root;