#!/bin/bash
rpm -e --nodeps mysql-libs-5.1.73-5.el6_6.x86_64
cp mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz /usr/local
cd /usr/local
tar -zxvf mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz
mv mysql-5.6.33-linux-glibc2.5-x86_64 mysql
groupadd mysql
useradd -g mysql mysql
cd /usr/local/mysql/
chown -R mysql:mysql ./
./scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
cp support-files/my-default.cnf /etc/my.cnf
echo 'export MYSQL_HOME=/usr/local/mysql' >> /etc/profile
echo 'export PATH=$MYSQL_HOME/bin:$PATH' >> /etc/profile
source /etc/profile
service mysqld start
cd /usr/local/bin
ln -fs /usr/local/mysql/bin/mysql mysql
# 安装完后 输入 mysql
# 输入 set password for 'root'@'localhost'=password('yxhd@2018'); 密码貌似不能用纯数字
#退出重启mysql服务