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 database installation path migration

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

System: centos7.3

Database: mysql5.7

Stop the business before migrating the mysql database installation path.

I. stop the database service

Systemctl stop mysqld

Second, check the storage of the server

Df-h

Enter the default installation directory of the database

Cd / var/lib/mysql

4. Check the file size under the default path of mysql

Du-h-max-depth=1 / var/lib/mysql

Copy / var/lib/mysql to / data directory

Cp-a / var/lib/mysql / data/

6. Enter the / etc directory and back up my.cnf

Cd / etc/

Cp my.cnf my.cnf-bak

7. Edit my.cnf and change the datadir and socket values to the new path

Vi my.cnf

VIII. Stop database service

Systemctl stop mysqld

IX. Start database service

Systemctl start mysqld

Log in to the database to verify the success of the migration

Attached:

Temporarily restart the database service

/ usr/sbin/setenforce 0

Change it to SELINUX=disabled to successfully restart the database service at any time

Vi / etc/selinux/config

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