General Information
Installing and configuring the MySQL drop in replacement, MariaDB.
The following virtual machines will be used:
Install the server and client utilities
yum install mariadb mariadb-server
Enable and start the service
systemctl enable mariadb
systemctl start mariadb
Open up the firewall for MariaDB
firewall-cmd --permanent --add-service=mysql firewall-cmd --reload
Run the secure configuration script
mysql_secure_installation
Configure MariaDB to listen on an IP address
vim /etc/my.cnf [mysqld] # Listen on this IP address bind-address=192.168.1.200
Restart the service
systemctl restart mariadb
Connect to the database
mysql -u root -p
Show the databases
MariaDB [(none)]> show databases;
Use a specific database
MariaDB [(none)]> USE mysql;
Show the tables in the current database
MariaDB [mysql]> SHOW TABLES;
Create a new user
MariaDB [(none)]> CREATE USER rjones@localhost IDENTIFIED by 'secret';
MariaDB [(none)]> help create user
Pre-Req: Create a quick database for the user to have permissions for
MariaDB [(none)]> CREATE DATABASE mydatabase;
Permissions for the new user
MariaDB [(none)]> GRANT SELECT,INSERT,UPDATE,DELETE ON mydatabase.* TO rjones@localhost;
MariaDB [(none)]> help grant
Flush privileges
MariaDB [(none)]> FLUSH PRIVILEGES;
Show privileges
MariaDB [(none)]> SHOW GRANTS FOR rjones@localhost;
Show all users
MariaDB [(none)]> SELECT user,host FROM mysql.user
Installing/configuring local and remote MariaDB clients.
MariaDB Server: Verify Server is listening
ss -tulpn | grep mysql
MariaDB Server: Connect to mariadb
mysql -u root -p
MariaDB Server: Grant privileges to root from the client IP address and flush privileges
MariaDB [(none)]> GRANT ALL ON *.* TO root@'192.168.1.150' IDENTIFIED BY 'password-here'; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> exit
MariaDB Server: Open up the firewall to allow mysql connections (if you have not already)
firewall-cmd --permanent --add-service=mysql firewall-cmd --reload
MariaDB Remote Client: Install components to remotely manage
yum install mariadb
MariaDB Remote Client: Connect remotely
mysql -h 192.168.1.151 -u root -p
To make it so the MariaDB server will only allow local client (socket) connections (and NOT from IP addresses):
Edit the MariaDB config file
vim /etc/my.cnf # Don't allow network connections to the database skip-networking=1
Restart the mariadb service
systemctl restart mariadb