1、检查是否已经安装了mysql 和 mariadb
rpm -qa | grep mysql
rpm -qa | grep mariadb
# 如果已经安装,就先卸载:
rpm -e --nodeps 软件名
2、安装mysql
按顺序安装:8.0.28-1.el7版本
rpm -ivh mysql-community-common-8.0.28-1.el7.aarch64.rpm
rpm -ivh mysql-community-client-plugins-8.0.28-1.el7.aarch64.rpm
rpm -ivh mysql-community-libs-8.0.28-1.el7.aarch64.rpm
rpm -ivh mysql-community-client-8.0.28-1.el7.aarch64.rpm
rpm -ivh mysql-community-icu-data-files-8.0.28-1.el7.aarch64.rpm
rpm -ivh mysql-community-server-8.0.28-1.el7.aarch64.rpm
注:8.0.28-1.el7版本后解压内容多了几个文件,安装顺序可能会有所改变
3、查看mysql状态
systemctl status mysqld
4、启动mysql服务
systemctl start mysqld
5、设置开机启动服务
systemctl enable mysqld
6、查看服务是否成功启动
netstat -tunlp | grep mysql
7、查看初始密码
cat /var/log/mysqld.log
# 或
cat /var/log/mysqld.log | grep password
# 找到密码,注意,不要冒号后的空格
8、登录mysql
mysql -uroot -p
9、远程访问授权
create user '用户名'@'%' identified with mysql_native_password by '密码';
grant all privileges on *.* to '用户名'@'%' with grant option;
flush privileges;
10、防火墙开启 3306 端口,
11、安装完毕!
PS:安装过程中可能提示要安装 net-tools 依赖:
yum install net-tools
PS:安装过程中可能提示依赖libaio….什么的,那么安装libaio再继续安装mysql剩下部分就可以:
yum install libaio
标签:8.0,安装,MySQL,28,mysql,rpm,el7 From: https://www.cnblogs.com/chuanwei/p/17433864.html更新yum源:
yum update