mysql 5.7安装
tar xf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz mv mysql-5.7.17-linux-glibc2.5-x86_64 /opt/mysql yum install -y compat-libstdc++-33 libaio libaio-devel useradd -M -s /sbin/nologin mysql mkdir -p /home/mysql/3306/{data,logs,binlog} chown -R mysql:mysql /home/mysql cd /opt/mysql ./bin/mysqld --defaults-file=/opt/mysql/conf/my3306.cnf --initialize --user=mysql --basedir=/opt/mysql --datadir=/home/mysql/3306/data #/opt/mysql/conf/my3306.cnf 链接:http://www.cnblogs.com/hanxiaohui/p/8669980.html #修改/opt/mysql/bin/mysqld_safe :1,$s@usr/local@opt@g /opt/mysql/scripts/my3306.sh start #脚本链接:http://www.cnblogs.com/hanxiaohui/p/8399191.html 登陆修改密码 #skip-grant-tables 重启 update mysql.user set authentication_string=password('123456') where user='root'; flush privileges; 初次登陆后需要执行: SET PASSWORD = PASSWORD('123456');这句话重新设置一次密码,不然什么都操作不了


mysql 5.6安装、
tar xf mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz

mv mysql-5.6.33-linux-glibc2.5-x86_64 /opt/mysql

yum install -y compat-libstdc++-33 libaio libaio-devel

useradd -M -s /sbin/nologin mysql

mkdir -p /home/mysql/3306/{data,logs,binlog}

chown -R mysql:mysql  /home/mysql

cd /opt/mysql

./scripts/mysql_install_db --user=mysql --datadir=/home/mysql/3306/data
#/opt/mysql/conf/my3306.cnf 链接:http://www.cnblogs.com/hanxiaohui/p/8399161.html
#修改/opt/mysql/bin/mysqld_safe  :1,$s@usr/local@opt@g

/opt/mysql/scripts/my3306.sh start
#脚本链接:http://www.cnblogs.com/hanxiaohui/p/8399191.html

登陆修改密码
装好是没有密码的
update mysql.user set password=password('123456') where user='root';
flush privileges;


授权
grant all on *.* to 'root'@'%' identified by '123456';
flush privileges;