I. System environment and description
System: centos6.x_x64 MySQL: Community Edition 5.6.21, open source database with the most MySQL, compile and install more cumbersome, yum installation version is low and the default installation location is/var/, this time using the official download RPM package, Automate the installation and customization of data directories into separate partitions (this is the/DATA1 directory) through scripting
Second, prepare the installation package
1. Official Download
#https://dev.mysql.com/downloads/mysql/5.6.html#downloads Select the corresponding version and platform package:
mysql-shared-compat-5.6.x-1.el6.x86_64.rpm #x就是你下的版本号以下类同
mysql-devel-5.6.x-1.el6.x86_64.rpm
mysql-shared-5.6.x-1.el6.x86_64.rpm
mysql-client-5.6.x-1.el6.x86_64.rpm
mysql-test-5.6.x-1.el6.x86_64.rpm
mysql-server-5.6.x-1.el6.x86_64.rpm
2, the package used in this experiment
The http://pan.baidu.com/s/1nvn0nUx contains the following packages:
mysql-shared-compat-5.6.21-1.el6.x86_64.rpm
mysql-devel-5.6.21-1.el6.x86_64.rpm
mysql-shared-5.6.21-1.el6.x86_64.rpm
mysql-client-5.6.21-1.el6.x86_64.rpm
mysql-test-5.6.21-1.el6.x86_64.rpm
mysql-server-5.6.21-1.el6.x86_64.rpm
Third, installation
1, if it is the official download, please do the following operations directly
#rpm-IVH mysql-shared-compat-5.6.x-1.el6.x86_64.rpm #提供基础依赖组件 requires the first installation
#yum Remove Mysql-libs-y #御载默认自带的mysql-lib
#yum Install libaio-y #安装libiao
#rpm-IVH mysql-devel-5.6.x-1.el6.x86_64.rpm
#rpm-IVH mysql-shared-5.6.x-1.el6.x86_64.rpm
#rpm-IVH mysql-client-5.6.x-1.el6.x86_64.rpm
#rpm-IVH mysql-test-5.6.x-1.el6.x86_64.rpm
#rpm-IVH mysql-server-5.6.x-1.el6.x86_64.rpm
2, the experiment script is as follows:
#!/bin/bashsrc_dir=$ (PWD) cd $src _dirtar xvf mysql5.6.21.x86_64.rpms.tar.gztar xvf Mysql5.6.21.x86_64.rpms.tarcd mysql5.6.21rpm -ivh mysql-shared-compat-5.6.21-1.el6.x86_64. rpmyum remove mysql-libs -yyum install libaio -yrpm -ivh mysql-devel-5.6.21-1.el6.x86_64.rpmrpm -ivh mysql-shared-5.6.21-1.el6.x86_64.rpmrpm -ivh mysql-client-5.6.21-1.el6.x86_64.rpmrpm -ivh mysql-test-5.6.21-1.el6.x86_64.rpmrpm -ivh mysql-server-5.6.21-1.el6.x86_64.rpm#service mysql start && echo "mysql5.6.21 has installes sucess! " #mysql_root_pwd = ' gawk -f : ' { print $4 } ' /root/.mysql_secret ' #echo ' A random root password has been set. you will find it in '/root/.mysql_secret '. " #echo "The random root password was: ' ${MYSQL_ROOT_PWd// } ' "service mysql stop[ -d /data1/mysqldb/data ] | | mkdir -p /data1/mysqldb/data[ -d /data1/mysqldb/log ] | | mkdir -p /data1/mysqldb/logchown mysql.mysql /data1/mysqldb -rcd /usr/bin. /mysql_install_db --user=mysql --basedir=/usr --datadir=/data1/mysqldb/data # Migrate Data Catalog to/data1/mysqldb/data customizable cd $src _dircp ${src_dir}/my.cnf /etccd /var/libmv mysql /tmpservice mysql start && echo "Mysql root password was empty. Please change when you login mysql. "
Iv. issues of attention
1. Disable SELinux Otherwise the script installation is unsuccessful
2, after installation of the system comes with postfix and crontab tools have been Imperial, re-install Yum once can
3, the root password of the MySQL service is empty, please modify the root password yourself
or add the following line in the script to automatically modify the MySQL root password after the MySQL migration directory starts.
mysqladmin-u root Password "123.com"
This article is from the "end of the school" blog, please be sure to keep this source http://dyc2005.blog.51cto.com/270872/1942745
centos6.x install mysql5.6 and customize Data Catalog with one click