0

Unable to change default data directory: form /var/lib/mysql to /mydata/db/mysql

  1. SELINUX disbaled

  2. Reboot done

  3. Configured at mariadb-server.cnf and also other necessary configuration done.

    [mysqld]

    datadir = /mydata/db/mysql

    socket = /mydata/db/mysql/mysql.sock

    pid-file = /run/mariadb/mariadb.pid

But after restart data directory not changing. What are the possible reason for this issue?

Shadow
  • 33,525
  • 10
  • 51
  • 64
  • What is the output frrom `ps aux | grep mysqld`or for recent versions `grep mariadbd`? – Georg Richter Aug 24 '22 at 12:35
  • 1
    I found that was due to permission issue server.cnf file permission should be 644. It is solved but now there is another issue that is " Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'" though i changed it to another location. – Sheikh Wasiu Al Hasib Aug 24 '22 at 15:37
  • Now it has been solved by short link but I am not sure why need short link ( ln -s /data/mysql_datadir/mysql.sock /var/lib/mysql/mysql.sock) is need here? I wan to do it without short link. I need to know the actual way to solve this. – Sheikh Wasiu Al Hasib Aug 24 '22 at 15:42
  • Oh, Good news , It is also solved. In this case I have another solution that is we can set for both client and server [client] socket=/mydata/db/mysql/mysql.sock [server] socket=/mydata/db/mysql/mysql.sock – Sheikh Wasiu Al Hasib Aug 24 '22 at 16:11
  • 1
    `[client-server] socket=/mydata/db/mysql/mysql.sock`. Also don't disable [selinux](https://mariadb.com/kb/en/selinux/), just relabel your new datadir per the link. – danblack Aug 25 '22 at 00:17

0 Answers0