当前位置:网站首页>Linux安装mysql5.7(CentOS7.6) 教程
Linux安装mysql5.7(CentOS7.6) 教程
2022-06-28 21:58:00 【梁萌】
1. 新建文件夹/opt/mysql,并cd进去
cd /opt/
mkdir mysql
cd mysql
2. 获取Mysql安装包:
提前下载好,直接放到mysql文件夹中
安装包下载地址:
https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar
3. 解压安装包
tar -xvf mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar
PS:centos7.6自带的类mysql数据库是mariadb,会跟mysql冲突,要先删除。
4. 运行tar -xvf mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar
5. 运行rpm -qa|grep mari,查询mariadb相关安装包
6. 运行rpm -e --nodeps mariadb-libs,卸载
7. 然后开始真正安装mysql,依次运行以下几条
rpm -ivh mysql-community-common-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.26-1.el7.x86_64.rpm
8. 运行systemctl start mysqld.service,启动mysql
9. 然后开始设置root用户密码
Mysql自动给root用户设置随机密码,运行grep "password" /var/log/mysqld.log 可看到当前密码

10. 运行mysql -u root -p,用root用户登录,提示输入密码可用上述的,可以成功登陆进入mysql命令行
11. 设置root密码,对于个人开发环境,如果要设比较简单的密码(生产环境服务器要设复杂密码),可以运行
set global validate_password_policy=0; (0代表可以设置弱密码)
(validate_password_policy默认值1)

12. set password for 'root'@'localhost' =password('这里输入你要设置的密码');
13. 运行 flush privileges 使密码设置生效
边栏推荐
- #yyds干货盘点# 解决剑指offer: 连续子数组的最大和(二)
- 華為雲的AI深潜之旅
- How can the sports app keep the end-to-side background alive to make the sports record more complete?
- 电商秒杀系统架构设计
- Native implementation Net 5.0+ custom log
- 用指针计算数组的个数
- Zero foundation self-study SQL course | complete collection of date functions in SQL
- 职业问诊 | 面试时被问到职业规划该怎么回答?
- Is it safe to open an account for stocks on mobile phones in 2022? Who can I ask?
- [linq]c list type grouping sum
猜你喜欢
![Sword finger offer:[day 2 linked list (simple)] --- > print the linked list from end to end](/img/d6/824985b74b27a1bee456c2cebbac26.jpg)
Sword finger offer:[day 2 linked list (simple)] --- > print the linked list from end to end

Zadig 面向開發者的自測聯調子環境技術方案詳解

Zadig 面向开发者的自测联调子环境技术方案详解

【电子实验2】简单电子门铃

Un voyage profond d'IA dans Huawei Cloud

Zero foundation self-study SQL course | complete collection of date functions in SQL

F1tenth gym of ROS 2 humble hawksbill

电商秒杀系统架构设计
![Sword finger offer:[day 1 stack and queue (simple)] --- > use two stacks to realize the queue](/img/e4/60b063a3131d92e40b5fa610bbec17.jpg)
Sword finger offer:[day 1 stack and queue (simple)] --- > use two stacks to realize the queue

城市大脑知识图谱构建及应用研究
随机推荐
Zadig + SonarQube,为开发过程安全保驾
水哥的代码
Visual studio 2022 17.1 is now available!
解读 | 数据分析的发展和演变都经过哪几个阶段?
场景化接口开发利器,金蝶云苍穹新版OpenAPI引擎来了!
为什么要使用 Rust 语言?
Zadig 构建究竟何强大?一起来实践
HTTP Caching Protocol practice
数据库基础笔记
运维体系建设思考 - 稳定性篇
共探数字技术与信息安全,第四届中俄数字论坛成功举办
External parameter calibration method for 16 line mechanical radar and monocular camera based on solid state lidar
杆会睡不着觉
F1tenth gym of ROS 2 humble hawksbill
ADB regular use of work notes
[software test] 2022 national unified college enrollment examination
Architecture design of e-commerce secsha system
Why use the rust language?
Zadig 面向開發者的自測聯調子環境技術方案詳解
PHP自学Go日记(四):GO的变量声明方式