2.2. Install the Database Server
2.2.1. Install the MariaDB Database Packages
- Provides the MariaDB database service.
- Provides the MariaDB service shared files. This package is installed as a dependency of the mariadb-galera-server package.
- Installs the Galera wsrep (Write Set REPlication) provider. This package is installed as a dependency of the mariadb-galera-server package.
yum install mariadb-galera-server
2.2.2. Configure the Firewall to Allow Database Traffic
Procedure 2.3. Configuring the Firewall to Allow Database Traffic
- Open the
/etc/sysconfig/iptablesfile in a text editor.
- Add an INPUT rule allowing TCP traffic on port
3306to the file. The new rule must appear before any INPUT rules that REJECT traffic:
-A INPUT -p tcp -m multiport --dports 3306 -j ACCEPT
- Save the changes to the
- Restart the
iptablesservice to ensure that the change takes effect:
systemctl restart iptables.service
2.2.3. Start the Database Service
Procedure 2.4. Starting the Database Service
- Start the
systemctl start mariadb.service
- Configure the
mariadbservice to start at boot time:
systemctl enable mariadb.service
2.2.4. Configure the Database Administrator Account
rootthat provides access to the MariaDB service from the machine on which the MariaDB service was installed. You must set a password for this account to secure access to the server hosting the MariaDB service. You must also enable access to the MariaDB service from machines other than the machine on which the MariaDB server is installed. It is also recommended that you remove the anonymous user and test database that are created during installation.
Procedure 2.5. Configuring the Database Administrator Account
- Log in to the machine on which the MariaDB service is installed.
- Use the
mysql_secure_installationto set the
rootpassword, allow remote root login, and remove the anonymous user account and test database:
-pand the old password:
mysqladmin -u root -pOLDPASS password NEWPASS
2.2.5. Test Connectivity
184.108.40.206. Test Local Connectivity
Procedure 2.6. Testing Local Connectivity
- Connect to the database service, replacing
USERwith the user name with which to connect:
mysql -u USER -p
- Enter the password of the database user when prompted.
220.127.116.11. Test Remote Connectivity
Procedure 2.7. Testing Remote Connectivity
- Install the MySQL client tools:
yum install mysql
- Connect to the database service, replacing USER with the database user name and HOST with the IP address or host name of the server hosting the database service:
mysql -u USER -h HOST -p
- Enter the password of the database user when prompted: