当前位置:网站首页>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 使密码设置生效
边栏推荐
- 职场人调研报告:裸辞占比最高的居然是中年人
- Construction and application of urban brain knowledge map
- 重磅!CDA认证考试备考答疑上线
- 10、标准I/O输入输出重定向及管道
- Move the mouse out of the selected area style cancel
- Why use the rust language?
- Description détaillée du schéma technique du sous - environnement syntonique auto - test de Zadig pour les développeurs
- Sword finger offer:[day 1 stack and queue (simple)] --- > use two stacks to realize the queue
- [golang] leetcode intermediate subset & Word Search
- GO语言-反射reflect
猜你喜欢

面试官:Redis中字符串的内部实现方式是什么?

直播预告|SQL也能玩转工业级机器学习?MLOps meetup V3带你一探究竟!

Yiming Anke submitted a statement to the Hong Kong Stock Exchange: the loss doubled in 2021, and the past financing amount was exaggerated

Adding a markdown editor to lavel

ansible生产环境使用场景(七):批量部署elk客户端

Move the mouse out of the selected area style cancel

宜明昂科在港交所递表:2021年亏损翻倍,过往融资额存在夸大情形

零基础自学SQL课程 | SQL中的日期函数大全

PE file-

6年心得,从功能测试到测试开发,送给在测试路上一路走到黑的你
随机推荐
Use of dynamic panels
Is the VIP securities account of qiniu school really safe and regular? How do I say this?
JS array common methods
[linq] execute SQL like in statements using EF to LINQ
Description détaillée du schéma technique du sous - environnement syntonique auto - test de Zadig pour les développeurs
硬件开发笔记(七): 硬件开发基本流程,制作一个USB转RS232的模块(六):创建0603封装并关联原理图元器件
flutter通过 GlobalKey 获取界面任意元素坐标尺寸
In order to control the risks, how to choose a franchise company?
How to use the style label of jade template- How to use the style tag with jade templates?
职业问诊 | 面试中被问到意向薪资时,该怎么回答?
Zadig 面向開發者的自測聯調子環境技術方案詳解
GO语言-反射reflect
10、标准I/O输入输出重定向及管道
ansible生产环境使用场景(七):批量部署elk客户端
Quartz定时任务触发器启动时设置
華為雲的AI深潜之旅
2022年股票在手机上开户安全吗?找谁可以办理?
数据库基础笔记
【电子实验2】简单电子门铃
16 `bs object Node name Div. attribute contents ` children descendants get child nodes and descendants