What is MariaDB
MariaDB is very popular SQL-based dadabase system. It is more powerful and fully compatible with it's "ancestor" - MySQL.
Why might you need to move MariaDB data directory to another location
There are two mainly reasons:
- Current disk's space is over;
- Faster disk drive installed and you want to improove databases performance.
How to change database data location
Before any opeations I strongly advice you to ensure what is current data location. Just open an SSH-session as root user, login to the MariaDB and run this command:
select @@datadir;
Quit and stop the service:
service mariadb stop
Create new directory and move databases data into:
Edit database service configuration file:
cat <<EOT >> /etc/my.cnf
[client]
socket=<new_data_directory>/mysql.sock
EOT
Create special socket-file and set permissions:
Start the service:
Check where is data located now:
select @@datadir;
Conclusion
After this article reading you knew what is MariaDB, possible reasons to move its data to other location and how to do this.