Join the community today
Register Now

MariaDB MySQL remote inbound connection issues ?

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by skringjer, Apr 24, 2019.

  1. skringjer

    skringjer Member

    49
    6
    8
    Apr 21, 2019
    Ratings:
    +7
    Local Time:
    9:21 PM
    Thank you very very much, i am encountering another problem, my sites cant connect to the database remotely, i have granted permissions to the database via this command

    Code:
    GRANT ALL ON DB.* TO [email protected]_OF_MY_CONNECTING SERVER IDENTIFIED BY 'USERPASS';
    Then i went in csf.conf and added

    Code:
    TCP_OUT = "2525,465,1110,1194,9418,20,21,22,25,53,80,110,113,443,587,993,995,3306"
    At the end mysql port, but i can not connect to the database whatsoever, http://prntscr.com/nfxsd3

    Also tried in terminal, can someone help? Checked the privilages both in Phpmyadmin and in mysql, they are there http://prntscr.com/nfxsti
     
  2. eva2000

    eva2000 Administrator Staff Member

    39,758
    8,769
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,494
    Local Time:
    2:21 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Is remote mysql server also running Centmin Mod LEMP stack ? Did you restart CSF Firewall after making /etc/csf/csf.conf changes ?
    Code (Text):
    csf -ra

    Centmin Mod LEMP stack installs CSF Firewall out of the box, so to be able to remotely connect to external servers, you need to whitelist and allow the remote IP address see the info below:
     
  3. skringjer

    skringjer Member

    49
    6
    8
    Apr 21, 2019
    Ratings:
    +7
    Local Time:
    9:21 PM
    The database is hosted in this same server Centminmod, i am trying to connect from another server remotely to this database

    And yes i did restart CSF
     
  4. eva2000

    eva2000 Administrator Staff Member

    39,758
    8,769
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,494
    Local Time:
    2:21 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    oh then you need to whitelist 3306 port on TCP_IN not TCP_OUT comma separated list to allow remote web server to connect inbound to TCP port 3306 on centmin mod/csf firewall protected server

    but better why is just to whitelist web server IP in CSF Firewall without whitelisting TCP_IN port 3306
     
  5. eva2000

    eva2000 Administrator Staff Member

    39,758
    8,769
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,494
    Local Time:
    2:21 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
  6. skringjer

    skringjer Member

    49
    6
    8
    Apr 21, 2019
    Ratings:
    +7
    Local Time:
    9:21 PM
    Issue fixed by tcp|in|d=3306|s=IP_HERE

    Thank you very much :)
     
  7. skringjer

    skringjer Member

    49
    6
    8
    Apr 21, 2019
    Ratings:
    +7
    Local Time:
    9:21 PM
    I have made changes to
    php-fpm.conf
    php-mycustom.conf
    my.cnf
    b_customphp.ini

    And domains nginx Vhost, will these changes be there if i upgrade centmin in the future.
     
  8. eva2000

    eva2000 Administrator Staff Member

    39,758
    8,769
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,494
    Local Time:
    2:21 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    (y)
    I'd get in habit of post new threads for new topics in correct forums as this helps all other members and readers long term ;)

    For custom php settings read centminmod.com/phpfpm.html#customphpini. You might want to create /etc/centminmod/php.d/b_customphp.ini to override centmin mod defaults at /etc/centminmod/php.d/a_customphp.ini and restart PHP-FPM. Such changes will persist when doing centmin mod upgrades.

    Also outlined in Getting Started Guide Step 17
     
  9. skringjer

    skringjer Member

    49
    6
    8
    Apr 21, 2019
    Ratings:
    +7
    Local Time:
    9:21 PM
    Okay thank you very much, will post new threads for new issues :) :) :)
     
    • Like Like x 1
  10. pamamolf

    pamamolf Premium Member Premium Member

    3,266
    307
    83
    May 31, 2014
    Ratings:
    +566
    Local Time:
    7:21 PM
    Nginx-1.13.x
    MariaDB 10.1.x
    Code:
    tcp|in|d=3306|s=11.22.33.44
    Can i just open a port there tcp in and out for all without specifing an ip?
     
  11. eva2000

    eva2000 Administrator Staff Member

    39,758
    8,769
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,494
    Local Time:
    2:21 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Not advisable security wise depending who has access to the remote source server. Just giving the server enough access to a particular port(s) is just safer especially if you're not the only person who has access to the remote source server.
     
  12. pamamolf

    pamamolf Premium Member Premium Member

    3,266
    307
    83
    May 31, 2014
    Ratings:
    +566
    Local Time:
    7:21 PM
    Nginx-1.13.x
    MariaDB 10.1.x
    I am asking because i am looking for an easy way to open one port not related to mysql as i am trying to create a bash script ....

    Thank you
     
..