下载地址:https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.27-1.el7.x86_64.rpm-bundle.tar
上传到 /home 目录下
tar -xf mysql-5.7.27-1.el7.x86_64.rpm-bundle.tar -C /home/mysql/
rpm -qa | grep mariadb
rpm -e --nodeps 文件名
rpm -qa | grep mysql
rpm -e --nodeps 文件名
yum install libaio
rpm -ivh mysql-community-common-5.7.27-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.27-1.el7.x86_64.rpm
rpm -ivh mysql-community-devel-5.7.27-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-5.7.27-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.27-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.27-1.el7.x86_64.rpm
如果报如下错误:
可通过http://www.rpmfind.net/linux/rpm2html/search.php?query=net-tools(x86-64)下载对应版本的安装包,上传至Linux系统,通过命令:yum localinstall -y net-tools-2.0-0.25.20131004git.el7.x86_64.rpm
进行安装。
查看mysql服务是否启动
service mysqld status
启动服务:
systemctl start mysqld
查看随机生成的密码
grep ‘temporary password’ /var/log/mysqld.log
mysql -u root -p
mysql> Enter password: (输入刚才查询到的随机密码)
mysql> SET PASSWORD FOR ‘root’@‘localhost’= “Jstw@123”;
mysql>GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ IDENTIFIED BY ‘Jstw@123’ WITH GRANT OPTION;
mysql>FLUSH PRIVILEGES;
mysql> exit
方法一 、vi /etc/rc.local 添加service mysqld start
方法二 、 执行 systemctl enable mysqld.service
(# 注意systemctl 中规定、服务的配置文件要以.service 为后缀
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload
firewall-cmd --list-all
netstat -ntpl (TCP类型已开放的端口)