当前位置:网站首页>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 使密码设置生效
边栏推荐
- The example application of histogram in data visualization makes the public performance results clear at a glance
- IPv6 comprehensive experiment
- BOE was brilliant for the Winter Olympics, but revealed another Chinese technology enterprise dominating the world
- 在亿学学堂开通证券账户是安全可靠的吗?
- Rosdep update using fishros to solve ros1/ros2 problems 2022
- Is it safe to open a stock trading account? Is it reliable?
- If you are a C developer, look at these three explicit programming techniques
- GO语言-反射reflect
- E-commerce is popular, how to improve the store conversion rate?
- PHP自学Go日记(四):GO的变量声明方式
猜你喜欢

C#/VB.NET 将PDF转为Excel

安全 创新 实践|海泰方圆受邀参加“数字时代的网信创新与价值共创”技术交流研讨会
![[golang] leetcode intermediate subset & Word Search](/img/3a/f63892160c25196335a633424c6d99.jpg)
[golang] leetcode intermediate subset & Word Search

硬件开发笔记(七): 硬件开发基本流程,制作一个USB转RS232的模块(六):创建0603封装并关联原理图元器件

电商秒杀系统架构设计

Analysis of CSRF Cross Site Request Forgery vulnerability

Gross vs60 billion. Is food safety the biggest obstacle to Weilong's listing?

The example application of histogram in data visualization makes the public performance results clear at a glance

别再问我,UI自动化测试怎么做了……

YAYA LIVE CTO 唐鸿斌:真正本地化,要让产品没有「产地」属性
随机推荐
关于杠杆的思考
宜明昂科在港交所递表:2021年亏损翻倍,过往融资额存在夸大情形
PHP自学Go日记(四):GO的变量声明方式
[dynamic programming] p1018 linear DP: maximum product
重磅!CDA认证考试备考答疑上线
F1tenth gym of ROS 2 humble hawksbill
【电子实验2】简单电子门铃
How do independent site sellers efficiently manage complex Facebook pages?
C#/VB.NET 将PDF转为Excel
JS array common methods
Google search is dying | DKB
rosdep update 使用小鱼fishros解决ros1/ros2问题 2022
Ctrip will push the "3+2" working mode: 3 days a week on duty and 2 days of free choice of office space. Do you envy it?
Zadig 面向開發者的自測聯調子環境技術方案詳解
现在还能入“坑”数据分析吗?看看2022年数据分析热门岗位!
Sword finger offer:[day 1 stack and queue (simple)] --- > use two stacks to realize the queue
HTTP Caching Protocol practice
flutter通过 GlobalKey 获取界面任意元素坐标尺寸
Sword finger offer:[day 2 linked list (simple)] --- > reverse linked list
Dart的类扩展、可选类型扩展