安装包准备
卸载自带的Mysql-libs
rpm -qa | grep -i -E mysql\|mariadb | xargs -n1 sudo rpm -e --nodeps
将安装包和JDBC驱动上传到 /opt/software
安装MySQL
安装mysql依赖
sudo rpm -ivh 01_mysql-community-common-5.7.16-1.el7.x86_64.rpm
sudo rpm -ivh 02_mysql-community-libs-5.7.16-1.el7.x86_64.rpm
sudo rpm -ivh 03_mysql-community-libs-compat-5.7.16-1.el7.x86_64.rpm
安装mysql-client
sudo rpm -ivh 04_mysql-community-client-5.7.16-1.el7.x86_64.rpm
安装mysql-server
sudo rpm -ivh 05_mysql-community-server-5.7.16-1.el7.x86_64.rpm
启动mysql
sudo systemctl start mysqld
查看mysql密码
sudo cat /var/log/mysqld.log | grep password
配置MySQL
查到的密码进入mysql
mysql -uroot -p'password'
更改mysql密码策略
set global validate_password_length=4;
set global validate_password_policy=0;
设置密码
set password=password("xxxxxx");
进入msyql库
use mysql
select user, host from user;
修改user表,把Host表内容修改为%
update user set host="%" where user="root";
刷新
flush privileges;
退出
quit;