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