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%';
相关推荐
其实防守也摸鱼4 小时前
SQL注入实验笔记
android·运维·数据库·安全·oracle·自动化
江屿风4 小时前
【Linux系统】【从【收尾】缓冲区到【新开】磁盘块:一节课打通文件系统底层原理】流食般投喂
linux·运维·服务器·人工智能·笔记
Pointer Pursuit4 小时前
编辑器Vim
linux·编辑器·vim
_upupup4 小时前
Linux中的权限解析
linux·服务器
曹牧4 小时前
Spring MVC : Controller 层URL划分
java·运维·服务器·前端
路漫漫其修远兮sjw4 小时前
Linux 运维知识点笔记(中级)
linux·运维·笔记
石一峰6994 小时前
Linux INPUT 与 I2C 子系统关联
linux·运维·计算机外设
做运维的阿瑞4 小时前
一张用户表串懂 MySQL 的库、表、列、行、主键
数据库·sql·mysql·oracle
细嗅蔷薇@4 小时前
MySQL中数据类型介绍
数据库·mysql