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

How to migrate mysql partitions

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

Share

Shulou(Shulou.com)05/31 Report--

This article focuses on "how to migrate the partition of mysql", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to migrate the partition of mysql.

Today, when I found that the slave of the master slave mysql forgot to install the largest partition of the data directory, it was installed directly to the root partition. 95% of the root partition has been used below df, as long as it is migrated.

Description:

a. It is the host of ec2. When provided by the partner, the largest partition is hung under / mnt so that we can define it by ourselves.

Df-h Filesystem Size Used Avail Use% Mounted on / dev/sda1 9.9G 8.9G 529m 95% / / dev/sdb 827G 201M 785G 1% / mnt b. The directories are all under / data

Procedure:

1. Stop the database first

/ usr/local/bin/admin-S / tmp/mysql.sock shutdown / usr/local/bin/mysqladmin-S / tmp/mysql2.sock shutdown 2. Move the mysql directory under / data to / mnt

Mv mysql / mnt 3. Uninstall / mnt

# the reason why parameters can be omitted is that umount / mnt 4 is defined in / etc/fstab. Edit / etc/fstab file

Vi / etc/fstab / dev/sdb / mnt ext3 defaults 0 0 # changed to / dev/sdb / data ext3 defaults 0 05. Remount / data partition

Mount / data or mount / dev/sdb 6. Restart the database to view the status

Show slave status

At this point, I believe you have a deeper understanding of "how to migrate the partition of mysql". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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