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 NoobMaster69

    208
    26
    28
    Apr 21, 2019
    Ratings:
    +43
    Local Time:
    4:23 AM
    Nginx 1.21.6
    MariaDB 10.3.x
    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 DBUSER@IP_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

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    9:23 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    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 NoobMaster69

    208
    26
    28
    Apr 21, 2019
    Ratings:
    +43
    Local Time:
    4:23 AM
    Nginx 1.21.6
    MariaDB 10.3.x
    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

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    9:23 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    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

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    9:23 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
  6. skringjer

    skringjer NoobMaster69

    208
    26
    28
    Apr 21, 2019
    Ratings:
    +43
    Local Time:
    4:23 AM
    Nginx 1.21.6
    MariaDB 10.3.x
    Issue fixed by tcp|in|d=3306|s=IP_HERE

    Thank you very much :)
     
  7. skringjer

    skringjer NoobMaster69

    208
    26
    28
    Apr 21, 2019
    Ratings:
    +43
    Local Time:
    4:23 AM
    Nginx 1.21.6
    MariaDB 10.3.x
    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

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    9:23 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    (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 NoobMaster69

    208
    26
    28
    Apr 21, 2019
    Ratings:
    +43
    Local Time:
    4:23 AM
    Nginx 1.21.6
    MariaDB 10.3.x
    Okay thank you very much, will post new threads for new issues :) :) :)
     
  10. pamamolf

    pamamolf Well-Known Member

    4,125
    429
    83
    May 31, 2014
    Ratings:
    +841
    Local Time:
    2:23 AM
    Nginx-1.29.x
    MariaDB 10.6.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

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    9:23 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    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 Well-Known Member

    4,125
    429
    83
    May 31, 2014
    Ratings:
    +841
    Local Time:
    2:23 AM
    Nginx-1.29.x
    MariaDB 10.6.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