当前位置:网站首页>Linux下最新版MySQL 8.0的下载与安装(详细步骤)
Linux下最新版MySQL 8.0的下载与安装(详细步骤)
2022-07-30 19:30:00 【m0_67401382】
前言
本篇文章基于Linux 环境下载与安装MySQL 8.0,像基于win 10系统下载离线版的方式一样安装(安装简单),如果没有远程服务器,可以在电脑上安装虚拟机使用
创建虚拟机教程详见:http://t.csdn.cn/IFAJN
基于Win 10系统下载与安装MySQL 8.0教程详见:http://t.csdn.cn/WyDAv
连接虚拟机工具安装教程详见:http://t.csdn.cn/XVy6u
一、下载MySQL
MySQL官网:https://www.mysql.com/cn/
MySQL 8.0下载地址:https://dev.mysql.com/downloads/mysql/
选择自己虚拟机安装的Linux版本,下载
二、安装MySQL
1.解压文件
直接右击解压就行,会解压出很多的 .rpm文件
2.上传文件
将下列选中文件上传
使用Xftp工具,上传至 /opt文件夹,如果上传状态错误,则关闭虚拟机防火墙以及赋予该文件夹最高权限:chmod -R 777 /opt
3.检查依赖
3.1、检查 /tmp临时目录权限
MySQL安装过程中,会通过MySQL用户在 /tmp目录下新建tmp_db文件,所以给 /tmp文件夹最高权限:chmod -R 777 /tmp
3.2、检查依赖
检查libaio:rpm -qa|grep libaio
检查net-tools:rpm -qa|grep net-tools
如果不存在需要到CentOS安装盘里进行rpm安装,如果是安装的带图形化界面,这些都是安装好的
4.安装
将上传的文件依次安装(顺序严格执行)
rpm -ivh mysql-community-common-8.0.29-1.el8.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.0.29-1.el8.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.29-1.el8.x86_64.rpm
rpm -ivh mysql-community-client-8.0.29-1.el8.x86_64.rpm
rpm -ivh mysql-community-server-8.0.29-1.el8.x86_64.rpm
在安装(server)时出现依赖检测失败:
在后面增加 --force --nodeps 忽略依赖关系
rpm -ivh mysql-community-server-8.0.29-1.el8.x86_64.rpm --force --nodeps
成功安装
5.查看版本
查看指令:mysql --version
3、使用MySQL
1.初始化服务
为了保证数据库目录与文件的所有者为mysql登录用户,如果是以root 身份运行mysql服务,则执行命令初始化:mysqld --initialize --user=mysql
会为root用户生成一个密码,登录之后需要设置一个新的密码,生成的临时密码会在日志中记录
查看密码:cat /var/log/mysqld.log
2.查看服务是否启动
命令:systemctl status mysqld
显示未启动则启动服务:systemctl start mysqld
如果启动成功,那么安装就没有问题
3.查看服务
查看进程:ps -ef | grep -i mysql
查看服务是否自启动:systemctl list-unit-files|grep mysqld.service
默认就是enabled
设置自启动:systemctl enable mysqld.service
设置不进行自启动:systemctl disable mysqld.service
4.登录
登录(将临时密码输入):mysql -u root -p
5.修改密码
如果不修改密码,无法操作数据库:alter user 'root'@'localhost' identified by '新密码'
修改密码之后,重新登录并查看数据库:show databases;
至此离线版的Linux系统安装Mysql 8.0安装成功,操作简单,后续会搭建主从库,再使用命令行在线安装
先自我介绍一下,小编13年上师交大毕业,曾经在小公司待过,去过华为OPPO等大厂,18年进入阿里,直到现在。深知大多数初中级java工程师,想要升技能,往往是需要自己摸索成长或是报班学习,但对于培训机构动则近万元的学费,着实压力不小。自己不成体系的自学效率很低又漫长,而且容易碰到天花板技术停止不前。因此我收集了一份《java开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
- NXP IMX8QXP replacement DDR model operation process
- VBA批量将Excel数据导入Access数据库
- Delay queue optimization (2)
- redis
- DM8: Single database and single instance to build a local data guard service
- Entering the applet for the first time
- VBA batch import Excel data into Access database
- The 17th "Revitalization Cup" National Youth Vocational Skills Competition - Computer Programmers (Cloud Computing Platform and Operation and Maintenance) Participation Review and Summary
- 深入浅出边缘云 | 3. 资源配置
- 防抖和节流有什么区别,分别用于什么场景?
猜你喜欢

MySQL分组后取最大一条数据【最优解】

卫星电话是直接与卫星通信还是通过地面站?

VBA connects Access database and Excel

The advanced version of the cattle brushing series (search for rotating sorted arrays, inversion of the specified range in the linked list)

NXP IMX8QXP replacement DDR model operation process

牛客刷题系列之进阶版(搜索旋转排序数组,链表内指定区间反转)

After 23 years of operation, the former "China's largest e-commerce website" has turned yellow...

OneFlow source code analysis: Op, Kernel and interpreter
![[hbuilder] cannot run some projects, open the terminal and cannot enter commands](/img/fa/63f36683d090558f3fe5f582d86ca0.png)
[hbuilder] cannot run some projects, open the terminal and cannot enter commands

阿里面试官:给我描述一下缓存击穿的现象,并说说你的解决思路?
随机推荐
Win11如何更改默认下载路径?Win11更改默认下载路径的方法
在华为云,见证迷你世界的神奇觉醒
MindSpore:对image作normalize的目的是什么?
MindSpore:【MindSpore1.1】Mindspore安装后验证出现cudaSetDevice failed错误
启动前台Activity
Common linked list problems and their Go implementation
【MindSpore】用coco2017训练Model_zoo上的 yolov4,迭代了两千多batch_size之后报错,大佬们帮忙看看。
Range.CopyFromRecordset 方法 (Excel)
The problem of writing go run in crontab does not execute
开心的聚餐
- daily a LeetCode 】 【 191. A number of 1
[Private Series] All kinds of strange problems encountered in daily PHP
Vulkan开启特征(feature)的正确姿势
7.29模拟赛总结
数据库索引:索引并不是万能药
浅聊对比学习(Contrastive Learning)第一弹
Download Win11 how to change the default path?Download Win11 change the default path method
MySQL database - DQL data query language
MindSpore:【模型训练】【mindinsight】timeline的时间和实际用时相差很远
2种手绘风格效果比较,你更喜欢哪一种呢?