安装Red Hat 7.2 开发包Java包全部安装
下载Mysql 5.7.12
wget http://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.12-1.el7.x86_64.rpm-bundle.tar
查看是否安装了MySQL
rpm -qa | grep mysql
卸载mysql
rpm -e –nodeps
解压mysql
tar -xvf mysql-5.7.12-1.el7.x86_64.rpm-bundle.tar
安装mysql
yum install mysql-community-{client,common,libs}-*
rpm -ivh mysql-community-server-5.7.12-1.el7.x86_64.rpm
启动Mysql服务
先用常规的启动方法 service mysqld start
z在使用最新启动方法 systemctl start mysqld.service
查看MySQL服务器的状态
sudo service mysqld status
生成随机密码
grep 'temporary password' /var/log/mysqld.log
2016-04-30T11:25:13.632616Z 1 [Note] A temporary password is generated for root@localhost: X9.L=p4iylZD
配置随机密码
mysql -uroot -p
X9.L=p4iylZD
ALTER USER 'root'@'localhost' IDENTIFIED BY 'HanZheng.123';
5.7中存储密码的字段不再是password了,变成了authentication_string
update mysql.user set authentication_string=password('root') where user='root'';
修改root密码后如果第一次使用root用户登入mysql系统还会需要重置一次root密码
SET PASSWORD=PASSWORD('root');
重新登陆
mysql -uroot -p
HanZheng.123