Home:ALL Converter>How to change mysql directory (and restart mysql)?

How to change mysql directory (and restart mysql)?

Ask Time:2018-05-06T15:30:37         Author:yarek

Json Formatter

My server disk /var is full I followed the instructions described in : How to change MySQL data directory?

I did that: (debian server)

  • stop mysql
  • copy /var/lib/mysql to /data/lib/mysql (with same rights)
  • change the config file (and put datadir to /data/lib/mysql)
  • restart mysql

But mysql is not able to start any more (If I do change back the datadir, it does restart)

mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql) Active: failed (Result: exit-code) since Sun 2018-05-06 09:22:58 CEST; 19s ago Process: 23233 ExecStop=/etc/init.d/mysql stop (code=exited, status=0/SUCCESS) Process: 24059 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)

mysql[24059]: Starting MySQL database server: mysqld . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . failed! systemd[1]: mysql.service: control process exited, code=exited status=1 systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon. systemd[1]: Unit mysql.service entered failed state.

Author:yarek,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/50197285/how-to-change-mysql-directory-and-restart-mysql