Step 1 â Transferring the MariaDB Knowledge Listing
mysql -u root -p
make a selection @@datadir;
Output:
+-----------------+
| @@datadir |
+-----------------+
| /var/lib/mysql/ |
+-----------------+
1 row in set (0.00 sec)
go out
sudo systemctl forestall mariadb
sudo systemctl standing mariadb
Output:
mysql systemd[1]: Stopped MariaDB database server.
sudo rsync -av /var/lib/mysql /mnt/my-volume-01
sudo mv /var/lib/mysql /var/lib/mysql.bak
Step 2 â Pointing to the New Knowledge Location
sudo vi /and so forth/my.cnf
[mysqld]
. . .
datadir=/mnt/my-volume-01/mysql
socket=/mnt/my-volume-01/mysql/mysql.sock
. . .
[client]
port=3306
socket=/mnt/my-volume-01/mysql/mysql.sock
!includedir /and so forth/my.cnf.d
Step 3 â Restarting MariaDB
sudo systemctl get started mariadb
sudo systemctl standing mariadb
mysql -u root -p
make a selection @@datadir;
Output
+----------------------------+
| @@datadir |
+----------------------------+
| /mnt/my-volume-01/mysql/ |
+----------------------------+
1 row in set (0.01 sec)
go out
Cleanup
sudo rm -Rf /var/lib/mysql.bak