
Fabian Tech Tips

Quick overview for mariadb install notes
Oct 13, 2024
2 min read
0
0
0
Quick overview of configuration in the event of rebuilding or replacing the server.
These notes are for quickly spinning up a MariaDB test server on the fly
MariaDB install
To install MariaDB 10.11 on Red Hat, follow these steps:
Enable the MariaDB 10.11 module:
sudo dnf module enablemariadb:10.11
Install the MariaDB server:
sudo dnf module install mariadb:10.11/server
Start the MariaDB service:
sudo systemctl start mariadb
Enable MariaDB to start on boot:
sudo systemctl enablemariadb
Secure the MariaDB installation:
sudo mysql_secure_installation
Verify the installation:
mysql -V
Firewall rules reqired
Firewall configuration for replication
sudo firewall-cmd --zone=public --add-port=3306/tcp --permanent
sudo firewall-cmd --zone=public --add-port=4567/tcp --permanent
sudo firewall-cmd --reload
Set permission for script to run
chown -R root:root /scripts; chmod -R 744 /scripts
Set Time zone
Fix time zone
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql
Linux Folders and groups
The Default data directory is /var/lib/mysql or /var/lib/mariadb However, this can be changed in the config file. If we would like to change this as normally you will have a mounted disk in an Azure VM, edit the /etc/my.cnf config file and add the line, datadir=/mnt/disk00/mariadb you will need to make the folder with mkdir -p /mnt/disk00/mariadb (option -p will make the sub directories if they aren’t made already) Once created we need to make mysql the owner chown -r mysq;mysql /mnt/disk00/mariadb we can then stop the service and move the files systemctl stop mariadb | mv /var/lib/mariadb/* /mnt/disk00/mariadb | systemctl start mariadb
We should also change the folder permissonis so only people in the Mysql group can access the files such as DBA usermod -a -G dbauser mysql (-a -G appends a group to a user overwise it will overwrite all groups). Once the user has permissions change the folder permissions chmod 660 /mnt/disk00/mariadb