English Czech
How To Allow Remote Access MYSQL/MariaDB/MYSQL Community
Add New Rule to Firewalld
Open SQL port (3306) on FireWalld:
sudo firewall-cmd --permanent --zone=public --add-service=mysql
## OR ##
sudo firewall-cmd --permanent --zone=public --add-port=3306/tcp
Restart firewalld.service
systemctl restart firewalld.service
Editing Conf. Files:
MySql -> `/etc/my.cnf/`
MySql Community -> `/etc/my.cnf.d/community-mysql-server.cnf`
MariaDB -> `/etc/my.conf`
you can ensure that with the following command `rpm -qc [package]`.
Navigate to the line that begins with the bind-address directive. It will look like this: you could set this directive to a wildcard IP address, either *, ::, or 0.0.0.0:
bind-address = 0.0.0.0
After changing this line, save and close the file and then restart the MySQL service:
sudo systemctl restart {mysqld|mariadb}
Creating a USER
CREATE USER 'your_username'@'host_ip_addr' IDENTIFIED BY 'your_password';
Replace your_username and your_password depending on what you want the username and password to be. Here, host_ip_addr is the hostname or IP address of the computer from where you want to connect to the MySQL/MariaDB server. You can also use % as host_ip_addr if you want to connect from any computer. It can also be something like 192.168.2.% if you want to connect from computers from the IP range 192.168.2.1 – 192.168.2.254.