Linux MySQL5.7 rpm离线安装
程序员文章站
2024-03-21 18:07:22
...
前言
使用到的环境是 MySQL 5.7 版本
演示
下载软件包,拷贝到 /root/vagrant/ 目录
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.28-1.el7.x86_64.rpm-bundle.tar
解压
tar xvf mysql-5.7.28-1.el7.x86_64.rpm-bundle.tar
安装依赖的程序包
yum install -y perl net-tools
卸载mariadb程序包
- Centos 捆绑了 mariadb-libs,所以必须先卸载
rpm -qa|grep mariadb
rpm -e mariadb-libs-5.5.60-1.el7_5.x86_64 --nodeps
or 使用这个方法
yum -y remove mari*
安装MySQL程序包
rpm -ivh mysql-community-common-5.7.28-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.28-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.28-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.28-1.el7.x86_64.rpm
如果出现以下问题,可以查找安装
error: Failed dependencies:
libaio.so.1()(64bit) is needed by mysql-community-server-5.7.28-1.el7.x86_64
libaio.so.1(LIBAIO_0.1)(64bit) is needed by mysql-community-server-5.7.28-1.el7.x86_64
libaio.so.1(LIBAIO_0.4)(64bit) is needed by mysql-community-server-5.7.28-1.el7.x86_64
yum search libaio
yum install -y libaio.x86_64
yum install -y libaio-devel.x86_64
修改MySQL目录权限
chmod -R 777 /var/lib/mysql/
初始化MySQL
mysqld --initialize
chmod -R 777 /var/lib/mysql/*
操作
启动服务
systemctl start mysqld
停止服务
systemctl stop mysqld
查看mysql状态
systemctl status mysqld
设置为开机启动
systemctl enable mysqld
重载所有修改过的配置文件
systemctl daemon-reload
查看默认密码
我这里密码是 >uUMt-C8.uwj
grep 'password' /var/log/mysqld.log
[Note] A temporary password is generated for aaa@qq.com: >uUMt-C8.uwj
修改默认密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Abc778899!';
允许远程使用root帐户
UPDATE user SET host = '%' WHERE user ='root';
FLUSH PRIVILEGES;
允许远程访问MySQL数据库(/etc/my.cnf)
character_set_server = utf8
bind-address = 0.0.0.0
开启防火墙3360端口
如果你是阿里云的主机,或者其他的线上主机,请自行去账号处设置安全组
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload
推荐阅读
-
Linux环境使用Shell脚本安装Mysql5.7
-
Linux MySQL5.7 rpm离线安装
-
Linux安装mysql5.7
-
Linux下RPM软件包的安装及卸载 博客分类: linux rpmlinux
-
iostat 离线安装 博客分类: linux 磁盘监控系统监控
-
【学习笔记 - Linux】CentOS7下安装jdk1.8、tomcat8.5、mysql5.7——搭建java web开发环境
-
[转] Linux下RPM软件包的安装及卸载 博客分类: linux linuxrpm
-
centos7 离线安装rpm包工具--yumdownloader
-
【mysql】Linux centos 7.5 + mysql5.7二进制自动安装脚本(包括自动修改root密码)
-
Linux下离线安装Docker最新版本