Insufficient Linux root partition space, MySQL data consumption is too large

Source: Internet
Author: User
Tags mysql in

background: ZABBIX(Centos 6.2 X64) Monitoring server in the installation of poor planning, the root partition is not large enough only 33G, the utilization has reached 98% , after use #du –sm The reason for the check is that the ibdata1 under mysql occupies 32G.

Optimization becomes imperative, and there are two ways to migrate MySQL in this machine.

The first is to modify .../etc/my.conf and other settings

The second is the method of soft connection.

The connection is relatively simple, and the second method is chosen quickly.


Shut down the server and add a new virtual hard disk to the virtual machine.


View the new hard drive

# fdisk–l


Create a new partition

# FDISK/DEV/SDB

N

P

1

ENTER


Formatting a new partition

# mkfs–t EXT4/DEV/SDB1


Create the relevant directory and mount it

# Mkdir–p/mysql_data

# Mount/dev/sdb1/mysqld_data


Add the following to the partition table, even if the system restarts will automatically load.

# Vi/etc/fstab

/dev/sdb1/mysqld_data EXT4 Defaults 1 1


stop MySQL in operation

#/etc/init.d/mysqld Stop


transfer/var/lib/mysql files to /mysql_data/mysql

# Mv/var/lib/mysql/mysql_data/mysql


creating a soft connection is similar Shortcuts for Windows

# Ln–s/mysql_data/mysql/var/lib/mysql

PS:ln–s original directory + target directory, in addition to the target directory MySQL cannot already exist.


Start MySQL

#/etc/init.d/mysqld Start


This article is from the "It Migrant Workers" blog, please be sure to keep this source http://owendiscovery.blog.51cto.com/8070199/1413388

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.