Skip to content

Instantly share code, notes, and snippets.

@alanzhaonys
Last active January 8, 2021 20:53
Show Gist options
  • Save alanzhaonys/d42d3925e947fc8f9cfc4cc9c8fd6a44 to your computer and use it in GitHub Desktop.
Save alanzhaonys/d42d3925e947fc8f9cfc4cc9c8fd6a44 to your computer and use it in GitHub Desktop.
MySQL remote access on Centos 8 and Httpd
1. Setup user
2. Add binding_address = 0.0.0.0 to my.cnf
3. Open up firewall below
# https://wiki.mikejung.biz/Firewalld
# Allow traffic to MySQL
yum install @mysql
systemctl enable mysqld
systemctl start mysqld
systemctl status mysqld
mysql_secure_installation
# Create user
# CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'user_password';
# GRANT ALL PRIVILEGES ON *.* TO 'database_user'@'localhost' WITH GRANT OPTION;
# FLUSH PRIVILEGES;
firewall-cmd --zone=public --add-service=mysql --permanent
systemctl restart firewalld
firewall-cmd --list-all
HTTPD
====
yum install httpd
yum install mod_ssl
systemctl enable httpd
systemctl start httpd
systemctl status httpd
mysql_secure_installation
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
systemctl restart firewalld
firewall-cmd --list-all
PHP
====
yum install php php-mysqlnd php-pdo php-gd php-mbstring php-dom php-curl php-intl php-json php-ldap php-xml php-zip php-opcache
systemctl restart httpd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment