Difference between revisions of "MySQL: Mengijinkan sambungan dari non-localhost"
Jump to navigation
Jump to search
Onnowpurbo (talk | contribs) (New page: Agar sambungan dari non-localhost dapat dilakukan, kita perlu mengedit vi /etc/mysql/my.cnf Default bind hanya dari localhost bind-address = 127.0.0.1 Ubah menjadi bind-...) |
Onnowpurbo (talk | contribs) |
||
(4 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 16: | Line 27: | ||
Ini sangat berbahaya, karena server mysql kita jadi gampang di hack | 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; |
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;