Skip to content

Instantly share code, notes, and snippets.

@ebta
Last active September 27, 2018 07:19
Show Gist options
  • Save ebta/70b0cef620a3f3717259b42263a7df3a to your computer and use it in GitHub Desktop.
Save ebta/70b0cef620a3f3717259b42263a7df3a to your computer and use it in GitHub Desktop.
Allow Remote MySQL (MariaDB) CentOS
-- Edit dulu file my.cnf ( biasanya di sini /etc/my.cnf )
-- [mysqld]
-- # bind sesuai dengan IP yg diijinkan 0.0.0.0 = allow all IP4
-- bind-address=0.0.0.0
-- # Disabling symbolic-links is recommended to prevent assorted security risks
-- symbolic-links=0
-- port=3306
-- Kemudian restart mysql: sudo systemctl restart mysql
-- Login ke mysql melalui terminal (ssh): mysql -uroot -p
-- Grant All ke root, pastikan ON-nya '%'.* bukan *.* <-- tidak akan bisa ngeset database ke user
GRANT ALL PRIVILEGES ON `%`.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
-- Jalankan di terminal sesuai port yg di open
-- iptables -I INPUT -i eth0 -p tcp --destination-port 3306 -j ACCEPT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment