Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mysql 8 cannot be started after modifying datadir under CentOS 7

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Try to modify the datadir parameter of mysql and copy the data file to the new directory / data, but when you start the mysql service, prompt:

[root@mysql8-01 data] # systemctl status mysqld

● mysqld.service-MySQL Server

Loaded: loaded (/ usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)

Active: failed (Result: exit-code) since Wed 2019-07-03 10:42:07 CST; 14s ago

Docs: man:mysqld (8)

Http://dev.mysql.com/doc/refman/en/using-systemd.html

Process: 2907 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS (code=exited, status=1/FAILURE)

Process: 2885 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)

Main PID: 2907 (code=exited, status=1/FAILURE)

Status: "SERVER_BOOTING"

Error: 13 (Permission denied)

Jul 03 10:42:06 mysql8-01 systemd [1]: Starting MySQL Server...

Jul 03 10:42:07 mysql8-01 systemd [1]: mysqld.service: main process exited, code=exited, status=1/FAILURE

Jul 03 10:42:07 mysql8-01 systemd [1]: Failed to start MySQL Server.

Jul 03 10:42:07 mysql8-01 systemd [1]: Unit mysqld.service entered failed state.

Jul 03 10:42:07 mysql8-01 systemd [1]: mysqld.service failed.

Check the mysql log and find the following warning

2019-07-03T02:38:28.679543Z 0 [System] [MY-010910] [Server] / usr/sbin/mysqld: Shutdown complete (mysqld 8.0.14) MySQL Community Server-GPL.

Mysqld: File'. / binlog.index' not found (OS errno 13-Permission denied)

2019-07-03T02:40:21.848131Z 0 [Warning] [MY-010091] [Server] Can't create test file / data/mysql8-01.lower-test

2019-07-03T02:40:21.848279Z 0 [System] [MY-010116] [Server] / usr/sbin/mysqld (mysqld 8.0.14) starting as process 2822

2019-07-03T02:40:21.867130Z 0 [Warning] [MY-010091] [Server] Can't create test file / data/mysql8-01.lower-test

2019-07-03T02:40:21.867181Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for / data/ is case insensitive

2019-07-03T02:40:21.868211Z 0 [ERROR] [MY-010119] [Server] Aborting

2019-07-03T02:40:21.868431Z 0 [System] [MY-010910] [Server] / usr/sbin/mysqld: Shutdown complete (mysqld 8.0.14) MySQL Community Server-GPL.

Mysqld: File'. / binlog.index' not found (OS errno 13-Permission denied)

2019-07-03T02:42:07.555956Z 0 [Warning] [MY-010091] [Server] Can't create test file / data/mysql8-01.lower-test

2019-07-03T02:42:07.556036Z 0 [System] [MY-010116] [Server] / usr/sbin/mysqld (mysqld 8.0.14) starting as process 2907

2019-07-03T02:42:07.558851Z 0 [Warning] [MY-010091] [Server] Can't create test file / data/mysql8-01.lower-test

2019-07-03T02:42:07.558865Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for / data/ is case insensitive

2019-07-03T02:42:07.559679Z 0 [ERROR] [MY-010119] [Server] Aborting

2019-07-03T02:42:07.559877Z 0 [System] [MY-010910] [Server] / usr/sbin/mysqld: Shutdown complete (mysqld 8.0.14) MySQL Community Server-GPL.

Here, you need to turn off Selinux:

[root@mysql8-01 data] # vi / etc/selinux/config

[root@mysql8-01 data] #

[root@mysql8-01 data] # setenforcing 0

Bash: setenforcing: command not found...

[root@mysql8-01 data] # setenforce 0

[root@mysql8-01 data] #

[root@mysql8-01 data] #

[root@mysql8-01 data] # systemctl start mysqld

[root@mysql8-01 data] #

[root@mysql8-01 data] #

[root@mysql8-01 data] # systemctl status mysqld

● mysqld.service-MySQL Server

Loaded: loaded (/ usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)

Active: active (running) since Wed 2019-07-03 10:46:09 CST; 5s ago

Docs: man:mysqld (8)

Http://dev.mysql.com/doc/refman/en/using-systemd.html

Process: 3020 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)

Main PID: 3042 (mysqld)

Status: "SERVER_OPERATING"

CGroup: / system.slice/mysqld.service

└─ 3042 / usr/sbin/mysqld

Jul 03 10:46:06 mysql8-01 systemd [1]: Starting MySQL Server...

Jul 03 10:46:09 mysql8-01 systemd [1]: Started MySQL Server.

Try to start again, successful

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report