How to change MySQL data directory?
Stop MySQL using the following command: sudo /etc/init.d/mysql stop Copy the existing data directory (default located in /var/lib/mysql) using the following command: sudo cp -R -p /var/lib/mysql /newpath edit the MySQL configuration file with the following command: sudo gedit /etc/mysql/my.cnf # or perhaps /etc/mysql/mysql.conf.d/mysqld.cnf Look for the entry for datadir, and change the path (which … Read more