I am trying to move the location of a mysql database. I tried to follow the instructions here and elsewhere, which say to change the "datadir" directory in "/etc/mysql/my.cnf". My problem is that "/etc/mysql/my.cnf" contains only this:

# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

As you can see, there is not a value "datadir".

Any help is much appreciated. I am running Ubuntu 15.04

1 Answer 1


Simply create a line datadir = /path where it says

# * Basic Settings

Then restart MySQL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.