#一、安装依赖包
 yum -y install ncurses-devel
 yum -y install gcc gcc-c++ openssl openssl-devel git
 yum -y install autoconf
 yum -y install cmake
 yum -y install bison-devel libaio libaio-devel perl-Data-Dumper net-tools
 yum -y install make gcc-c++ cmake bison bison-devel ncurses-devel libaio libaio-devel perl-Data-Dumper net-tools#二、添加用户及组,/data为数据目录
 groupadd -r mysql
 useradd -r -g mysql -s /sbin/nologin mysql
 chown -R mysql.mysql /data#将当前相同linux环境的打包文件发到目标端
 cd /usr/local
 scp mysql.tar.gz  root@x.x.x.x:/usr/local scp /etc/my.cnf root@x.x.x.x:/etc/
cd /data
 scp mysql_data.tar.gz  root@x.x.x.x:/data/  #三、目标库解压,赋权,修改相关属性
 cd /usr/local
 tar -zxvf mysql.tar.gz
 cd /usr/local
 chown -R root:mysql /usr/local/mysqlcd /data
 tar -zxvf mysql_data.tar.gz
 cd /data
 chown -R mysql:mysql mysql cd /usr/local/mysql
 cp support-files/mysql.server /etc/init.d/mysqld
 chmod +x /etc/init.d/mysqld
 chkconfig mysqld off
 chkconfig --list mysqldvi /etc/profile.d/mysql.sh
 export PATH=$PATH:/usr/local/mysql/bin#四、配置生效
 source /etc/profile#五、调整配置文件及相关
 cd /data/mysql
 rm -rf auto.cnfvi /etc/my.cnf
service mysqld status
service mysqld start
#六、测试登录
 mysql -uroot -p -P3306 -h127.0.0.1#七、root用户初始化
 select user,password,host from mysql.user;
 delete from mysql.user  where user='';
 delete from  mysql.user where password ='' and user='root';
 update  mysql.user set host='%' where user='root' ;
 select user,password,host from mysql.user;
 flush privileges;SET PASSWORD FOR 'root'@'%' = PASSWORD('xxxxxxxx');
 flush privileges;