Home > Database > Mysql Tutorial > body text

迁移mysql分区_MySQL

WBOY
Release: 2016-06-01 13:44:28
Original
777 people have browsed it

bitsCN.com

 

今天发现主从mysql的slave时忘记把数据目录安装最大的分区上,直接装到根分区了,df以下已经使用根分区95%了,只要迁移了。

 

说明:

a. 是ec2的主机,合作方提供的时候都是把最大分区挂到/mnt下,好由我们自己定义

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. 数据库目录都在/data下

 操作步骤:

 1. 先停止数据库

/usr/local/bin/mysqladmin -S /tmp/mysql.sock shutdown  /usr/local/bin/mysqladmin -S /tmp/mysql2.sock shutdown  2. 将/data下的mysql目录移动到/mnt中

mv mysql /mnt 3. 卸载/mnt

# 可以省略参数的原因是,在/etc/fstab中有定义  umount /mnt   4. 编辑/etc/fstab文件

vi /etc/fstab  /dev/sdb /mnt ext3 defaults 0 0  # 改为  /dev/sdb /data ext3 defaults 0 0  5. 重新挂载/data分区

mount /data或mount /dev/sdb 6. 重启数据库,查看状态

show slave status 

 

本文出自 “linuxjcq” 博客

bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!