[MDEV-17769] After changing datadir, unable to start the mariadb Created: 2018-11-19  Updated: 2018-11-19  Resolved: 2018-11-19

Status: Closed
Project: MariaDB Server
Component/s: Configuration
Affects Version/s: None
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Prabha Assignee: Unassigned
Resolution: Not a Bug Votes: 0
Labels: None


 Description   

Hi,

I am new to mariadb, for our upcoming client i am learning Mariadb.

I have installed Mariadb 10.2 on centos 7, then i want to change the default datadir from /var/lib/mysql to /home/data. For that i have performed below steps.

1)stopped mysql.
2)created new dir.
3)copied all the data from old to new location.
4)copied my-small.cnf from /usr/share/myql/ to /etc/my.cnf(since i didnt get the default my.cnf).
5)added below lines

[mysqld]
datadir=<new loc>
socket=/<new loc>/mysql.sock
[client]
port=3306
socket=/<new loc>/mysql.sock

6)changed ownership to mysql:mysql for /etc/my.cnf and new loc.

then i tried to start mysql but facing below error message.

Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details.

Please help me.

Thanks,
Prabha.



 Comments   
Comment by Elena Stepanova [ 2018-11-19 ]

Have you checked "systemctl status mariadb.service" and "journalctl -xe" for details, as it suggested?

Comment by Prabha [ 2018-11-19 ]

Hi Elena,

Below is the o/p .

tails.
[root@mariadb ~]# systemctl status mariadb.service
● mariadb.service - MariaDB 10.2.19 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/mariadb.service.d
└─migrated-from-my.cnf-settings.conf
Active: failed (Result: exit-code) since Mon 2018-11-19 20:49:02 IST; 11s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 3081 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
Process: 3024 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
Process: 3021 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Main PID: 3081 (code=exited, status=1/FAILURE)
Status: "MariaDB server is down"

Nov 19 20:49:02 mariadb.com systemd[1]: Starting MariaDB 10.2.19 database server...
Nov 19 20:49:02 mariadb.com mysqld[3081]: 2018-11-19 20:49:02 140522322753728 [Warning] option 'table_open_cache': unsigned value 4 adjusted to 10
Nov 19 20:49:02 mariadb.com mysqld[3081]: 2018-11-19 20:49:02 140522322753728 [Note] /usr/sbin/mysqld (mysqld 10.2.19-MariaDB) starting as...3081 ...
Nov 19 20:49:02 mariadb.com mysqld[3081]: 2018-11-19 20:49:02 140522322753728 [ERROR] Can't find messagefile '/home/data/share/mysql/errmsg.sys'
Nov 19 20:49:02 mariadb.com mysqld[3081]: 2018-11-19 20:49:02 140522322753728 [ERROR] Aborting
Nov 19 20:49:02 mariadb.com systemd[1]: mariadb.service: main process exited, code=exited, status=1/FAILURE
Nov 19 20:49:02 mariadb.com systemd[1]: Failed to start MariaDB 10.2.19 database server.
Nov 19 20:49:02 mariadb.com systemd[1]: Unit mariadb.service entered failed state.
Nov 19 20:49:02 mariadb.com systemd[1]: mariadb.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
[root@mariadb ~]# journalctl -xe
– Subject: Unit session-2.scope has finished start-up
– Defined-By: systemd
– Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

– Unit session-2.scope has finished starting up.

– The start-up result is done.
Nov 19 20:50:01 mariadb.com systemd[1]: Starting Session 2 of user root.
– Subject: Unit session-2.scope has begun start-up
– Defined-By: systemd
– Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

– Unit session-2.scope has begun starting up.
Nov 19 20:50:01 mariadb.com CROND[3098]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Nov 19 20:50:01 mariadb.com systemd[1]: Removed slice User Slice of root.
– Subject: Unit user-0.slice has finished shutting down
– Defined-By: systemd
– Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

– Unit user-0.slice has finished shutting down.
Nov 19 20:50:01 mariadb.com systemd[1]: Stopping User Slice of root.
– Subject: Unit user-0.slice has begun shutting down
– Defined-By: systemd
– Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

– Unit user-0.slice has begun shutting down.

Comment by Elena Stepanova [ 2018-11-19 ]

Well, as you can see, it attempts to find under your home dir files which are not there. Possibly you changed the basedir in the config file, or otherwise indicated a wrong location.

Please also note that even if you resolve it, probably it won't work right away, because the service configuration file by default has ProtectHome enabled, and you didn't mention that you have changed it.

In general, JIRA is a bug tracking system and isn't a right place for seeking help with your configuration. Please use community forums and mailing lists. You can also consider acquiring a support contract if you don't have one yet; if you do, please file a support ticket for assistance with your configuration.

Generated at Thu Feb 08 08:38:58 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.