How to move mysql datadir

This example will show you how to move MySQL datadir to another dir (in my case to “/mysqldata”) step-by-step (OS: Linux Mint):

1. create new dir (/mysqldata) and set permissions to it

sudo mkdir /mysqldata
sudo chown mysql:mysql /mysqldata/

Continue reading