Moving to the Default Directory
Is there a web page which describes the proper steps to move the default directory from /var/lib/mysql to another directory?
I find steps by querying google but they seems incomplete. I get the following error message when moving both my
datadir=/home/maria/mysql socket=/home/maria/mysql.sock
all data from /var/lib/mysql was also copied to /home/maria/sql
Upon restart I get the error below
Database MariaDB is not initialized, but the directory /home/maria/mysql is not empty, so initializatio Jan 17 06:47:01 BillLaptop systemd[1]: mariadb.service: Control process exited, code=exited status=1 Jan 17 06:47:01 BillLaptop systemd[1]: Failed to start MariaDB 10.2 database server. Jan 17 06:47:01 BillLaptop systemd[1]: mariadb.service: Unit entered failed state. Jan 17 06:47:01 BillLaptop systemd[1]: mariadb.service: Failed with result 'exit-code'.
Answer
Hi,
you could use one of these tutorial for example:
- https://www.tecmint.com/change-default-mysql-mariadb-data-directory-in-linux/
- https://www.digitalocean.com/community/tutorials/how-to-change-a-mariadb-data-directory-to-a-new-location-on-centos-7
But please first read this official documentation to be sure you understand the configuration system variables: https://mariadb.com/kb/en/library/server-system-variables/#datadir
Regards,
Faustin