I've tried to change the default data directory of MariaDB on Ubuntu. I created a new directory MySQL in /media/utente/E_linux and execute the following command to make MySQL the owner of it.
# chown -R mysql:mysql /media/utente/E_linux/mysql
I copied the contents of /var/lib/mysql to /media/utente/E_linux/mysql
# cp -R -p /var/lib/mysql/* /media/utente/E_linux/mysql
I modified the configuration file changing the row of datadir:
However, the server fails to start giving the following error message: Job for mariadb.service failed because the control process exited with an error code. See "systemctl status mariadb.service" and "journalctl -xe" for details.
I also tried to edit mariadb.service configuration file setting ProtectHome = false.
I don't understand what the problem is.
systemctl status mariadb.service produces this output: