Get the App
SLTechnology News&Howtos  ›  Development  › 

How to configure CentOS7 MariaDB allows you to specify IP remote connection to the database

Shulou Source: shulou.com Published: 2022-06-01 00:39:06 09月21日 Update

Most people do not understand the knowledge points of this article "CentOS7 how to configure MariaDB to allow IP to connect remotely to the database", so the editor summarizes the following, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to configure CentOS7 MariaDB to allow you to specify IP remote connection to the database" article.

Firewalls

The firewall before CentOS7 is different, for example, if you want to add port 3306:

# # all iptables-An INPUT-p tcp-m tcp-- dport 3306-j ACCEPT # # part ipiptables iptables-An INPUT-p tcp-s 138.111.21.11-dport 3306-j ACCEP service iptables save service iptables restart # # View iptables iptables-L-n

But this doesn't work in CentOS 7. Only by looking at the documentation do you know that CentOS 7 uses an enhanced version of firewall.

Firewall-cmd-- zone=public-- permanent-- add-port=3306/tcp1, firwall-cmd: a tool for operating firewall provided by Linux; 2,-- permanent: set to persistent; 3,-- add-port: identify the added port; 4,-- zone=public: the specified zone is public

Of course, if we are not used to using commands, we can change the configuration file directly.

Enter etc/firewalld/zone and modify public.xml

Public For use in public areas. Open the specified ip, the specified port, and the protocol to open port 9527 of any ip access server

As can be seen from the above configuration file:

1. Add the required rules: open source ip 122.10.70.234, port 514, protocol tcp;2, open source ip 123.60.255.14, port 10050-10051, protocol tcp;/3, open source ip arbitrary, port 9527, protocol firewall common commands # restart service firewalld restart # turn on service firewalld start # close service firewalld stop# view firewall service status systemctl status firewall# view firewall firewall-cmd-- list-all

After opening the server 3306 to the public, you also need to set the database user authorization

The above is about the content of this article on "how to configure CentOS7 MariaDB to allow you to specify IP remote connection database". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

Tags: Port configuration content data database open firewall access source service fire prevention command file article server knowledge article bad value most open to the outside world Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Docker Shulou Tech Info Huawei OPPO Reno