MySql varsayılan olarak uzaktan bağlantıya kapalı bir şekilde gelir ve bunun nedeni güvenlik zafiyetini önlemektir.
Şimdi adım adım Ubuntu 16.04 üzerinde, MySql sunucumuzun uzaktan erişimini aktif hale getirelim.
1. Güvenlik duvarı kontrolü ve yeni kural tanımlaması yapalım.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Konsolumuzda; sudo ufw status komutu ile güvenlik duvarının aktif olup olmadığını kontrol ediyoruz. Güvenlik duvarı aktif ise aşağıdaki komutumuz ile 3306 portuna erişim izni veriyoruz. Çünkü MySql 3306 portunu kullanmaktadır. Güvenlik duvarımız aktif değilse aşağıdaki komutları çalıştırmamıza gerek yoktur.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2. Varsayılan olarak kapalı gelen MySql sunucumuza uzaktan erişim izni verelim
Aşağıdaki MySql ayarlarının bulunduğu dosyayı nano editorumuz ile açıyoruz.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dosyayı açtıktan sonra dosyanın içinde aşağıdaki satırları buluyoruz.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bind-address = 127.0.0.1 satırını aşağıdaki şekilde değiştiriyoruz. Bunu yaparak MySql sunucumuza; local hostumuz (127.0.0.1) haricinde dışarıdan bağlanmaya izin veriyoruz.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3. Uzatan erişim için yeni bir MySql kullanıcısı oluşturalım.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4. Son olarak MySql sunucumuzu yeniden başlatıyoruz.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE USER ‘kullanici_adi’@’%’;
dosyanın içinemi konsolamı yazıyoruz.