Your data can grow over time, and when it outgrows the filesystem, you need to add a disk or move the data directory to a bigger volume.
Changing the data directory
How to do it...
- Check the current data directory. By default, the data directory is /var/lib/mysql:
mysql> show variables like '%datadir%';
+---------------+-----------------+
| Variable_name | Value |
+---------------+-----------------+
| datadir | /var/lib/mysql/ |
+---------------+-----------------+
1 row in set (0.04 sec)
- Stop mysql and make sure it has stopped successfully:
shell> sudo systemctl stop mysql
- Check the status:
shell> sudo systemctl status mysql
It should show Stopped MySQL Community Server.
- Create the...