Linux CentOS7 rpm 安装 MySQL 5.7

Linux CentOS7 rpm 安装 MySQL 5.7

一、参考资料

【MySQL数据库入门到大牛,mysql安装到优化,百科全书级,全网天花板】 https://www.bilibili.com/video/BV1iq4y1u7vj/?p=99\&share_source=copy_web\&vd_source=855891859b2dc554eace9de3f28b4528

VMvare 安装 CentOS 7

二、笔记总结

2.1、上传 rpm 安装包

2.2、卸载系统自带的 mariadb

bash 复制代码
#查看是否安装了
rpm -qa | grep -i mariadb
#如果有,卸载掉。
rpm -ivh mysql-community-common-5.7.28-1.el7.x86_64.rpm

2.3、检查权限和依赖

bash 复制代码
chmod -R 777 /tmp
rpm -qa|grep libaio
rpm -qa|grep net-tools

2.4、按顺序安装

bash 复制代码
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

2.5、检查安装结果

bash 复制代码
rpm -qa | grep -i mysql
bash 复制代码
cat /var/log/mysqld.log
#默认密码:tbtwty0tXP*i

2.6、启动 MySQL

bash 复制代码
#启动
systemctl start mysqld
#查看状态
systemctl status mysqld
bash 复制代码
#检查是否开机自启动
systemctl list-unit-files|grep mysqld.service

2.7、登录 MySQL

bash 复制代码
mysql -uroot -p
alter user 'root'@'localhost' identified by 'abc123';

2.8、设置远程连接权限

sql 复制代码
use mysql
select host,user from user;
update user set host = '%' where user = 'root';
flush privileges;

2.9、修改字符集编码

bash 复制代码
vim /etc/my.cnf
character_set_server=utf8
#重启 MySQL 生效
systemctl restart mysqld.service
sql 复制代码
mysql -uroot -p
show variables like '%character%';
相关推荐
无足鸟ICT1 小时前
【RHCA+】sosreport(收集诊断文档)
linux·运维·服务器
GeW1 小时前
世界目光聚焦中国:底层技术、Linux、数据库的破局逻辑
linux·数据库
IT大白鼠1 小时前
当 AI 开始自动化渗透:FBI ARTEX 警报的防守对策
运维·人工智能·自动化
Decay__2 小时前
SQLServer 运维自动化平台 —— PowerShell + SQL Agent 作业:部署、监控、巡检、告警、工单闭环一体化
运维·数据库·sql·mysql·架构
A-刘晨阳2 小时前
K8S 二进制集群搭建(一主两从)v1.37.2 版本
运维·云原生·容器·kubernetes·calico·nerdctl
tonydf2 小时前
没完了,Nginx又报新漏洞!
运维·nginx
星恒随风3 小时前
MySQL 从零入门(十):MVCC、Undo Log 与 Read View 详解——InnoDB 如何实现事务隔离?
linux·数据库·笔记·sql·mysql
瑞雪兆丰年兮4 小时前
Linux零基础快速入门-第二章 Linux基础命令
linux·运维·服务器
lambo mercy4 小时前
01初识docker
运维·docker·容器
进击的荆棘4 小时前
MySQL——数据类型
数据库·mysql