When storing data on Linux, MySQL is undoubtedly a solid choice. Its default data directory is /var/lib/mysql. In the past, my databases were never very large—only around ten gigabytes total—so leaving them in the default location was no problem. But today, after importing a new database whose data alone exceeded 30 GB, things went south instantly: I hadn't allocated enough disk space for the / partition. So tweaking the configuration and migrating the MySQL data directory to a more appropriate location became the easiest fix.

Stop MySQL and prepare the data

Since this is a mid-operation change, there's existing historical data to preserve. Start by stopping the database service. On my Fedora 19 box, the command looks something like this:
# service mysqld stop
Then safely copy everything from the default `/var/lib/mysql` directory to the target location—for example, `/home/mysql` in my case.

Update the configuration files

my.cnf

First, edit `/etc/my.cnf`. Look for entries like `datadir` and `socket`; their meanings are self-explanatory—just point them to the new paths. Of course, `my.cnf` might live somewhere else, and brand-new users may not even find one, but that's fine:
ls /usr/share/mysql/
You should see several `mysql-XXX-cnf` files. Pick one as a template, tweak it, and drop it into `/etc`.

get_mysql_option

Besides the cnf file, you also need to adjust a `get_mysql_option` setting—which is honestly a bit annoying...

Most online guides refer to older versions and tell you to edit /etc/rc.d/init.d/mysqld. On Fedora 19, however, that script doesn't exist. Check the error log and you'll see something like this:

Bash
[root@f-argcv etc]# systemctl status mysqld.service
mysqld.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled)
   Active: failed (Result: exit-code) since Wed 2013-10-23 19:38:22 HKT; 8s ago
  Process: 4936 ExecStartPost=/usr/libexec/mysqld-wait-ready $MAINPID (code=exited, status=1/FAILURE)
  Process: 4935 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=0/SUCCESS)
  Process: 4913 ExecStartPre=/usr/libexec/mysqld-prepare-db-dir %n (code=exited, status=0/SUCCESS)

Oct 23 19:38:20 f-argcv systemd[1]: Starting MariaDB database server...
Oct 23 19:38:21 f-argcv mysqld_safe[4935]: 131023 19:38:21 mysqld_safe Logging to '/var/log/mysqld.log'.
Oct 23 19:38:21 f-argcv mysqld_safe[4935]: 131023 19:38:21 mysqld_safe Starting mysqld daemon with databases from /home/mysql/data
Oct 23 19:38:21 f-argcv mysqld_safe[4935]: 131023 19:38:21 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
Oct 23 19:38:22 f-argcv systemd[1]: mysqld.service: control process exited, code=exited status=1
Oct 23 19:38:22 f-argcv systemd[1]: Failed to start MariaDB database server.
Oct 23 19:38:22 f-argcv systemd[1]: Unit mysqld.service entered failed state.
The culprit seems to be /usr/libexec/mysqld-wait-ready. Inspect and update the basedir and related parameters, then start it up...

Alternative approach

Confucius said, "If the Way does not prevail, I will take a raft and float upon the sea." The same goes for us: if all else fails, there's always the last resort—back up your data, uninstall, and reinstall. With `yum` around, that's actually quite convenient. Then configure the files properly, especially editing `/usr/bin/mysql_install_db` and its `ldata` parameter:
mysql_install_db 
and you're done.

Postscript

Later, I reinstalled the machine and gave `/var` its own expandable partition. Personally, I think that's the most comfortable setup.