一、下载
下载地址:https://dev.mysql.com/downloads/mysql/
二、解压
tar xvf mysql-5.7.36-1.el7.x86_64.rpm-bundle.tar
三、按顺序安装rpm包
rpm -ivh mysql-community-common-5.7.36-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.36-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.36-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.36-1.el7.x86_64.rpm
安装client会报错:
警告:mysql-community-client-5.7.36-1.el7.x86_64.rpm:
错误:依赖检测失败:
libncurses.so.5()(64bit) 被 mysql-community-client-5.7.36-1.el7.x86_64 需要
libtinfo.so.5()(64bit) 被 mysql-community-client-5.7.36-1.el7.x86_64 需要
执行以下命令,安装ncurses-compat-libs解决:
dnf install ncurses-compat-libs
四、启动
systemctl start mysqld
五、找到初始密码
cat /var/log/mysqld.log | grep 'password is generated'
六、修改密码并授权
alter user 'root'@'localhost' identified by 'xxxxxx';
grant all privileges on *.* to 'root'@'%' identified by 'xxxxxx' with grant option;
flush privileges;
七、开启防火墙,允许外网访问
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload
firewall-cmd --list-ports
版权声明:本文为u012069313原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。