Databases: installing MariaDB and creating a user
Sign in to read this lesson
A web application's data is kept on a separate database server. In this lesson we build MariaDB on srv-db01, secure it with mysql_secure_installation, create a user for the application with rights only to its own database, and open the network connection from the web server together with firewalld and SELinux.
What you will learn
dnf install mariadb-server,systemctl enable --now mariadb, then alwaysmysql_secure_installation.- A separate database and user for the application:
CREATE USER 'shop'@'10.20.0.15' IDENTIFIED BY '...'; GRANT ALL ON shopdb.* TO .... - A user is a
name@hostpair:'shop'@'10.20.0.15'can connect only from the web server. - Network:
firewall-cmd --add-service=mysql(or a rich rule for the web server only); on the web side, SELinux:setsebool -P httpd_can_network_connect_db on. - Backup:
mysqldump --single-transaction shopdb > shopdb.sql; restore:mysql shopdb < shopdb.sql.
The lesson has 5 key points, an explanation and 5 questions. It opens with a package.