首页 > 数据库 >ubuntu 22.04安装mysql5.7

ubuntu 22.04安装mysql5.7

时间:2023-10-16 14:11:59浏览次数:42  
标签:multiverse mysql5.7 ubuntu apt 22.04 mysql main com

ubuntu 22.04系统安装mysql5.7

一、查看系统默认安装的数据库版本

apt-get update
apt-cache policy mysql-server

image

ubuntu 20.04自带的版本是8.0.34,而我们需要安装mysql5.7的版本就需要换源

二、更换apt源

1. 备份原来的source文件

cp /etc/apt/sources.list /etc/apt/sources.list.back

2.修改sources.list文件

点击查看代码
#  阿里源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

三、更新镜像源

gpg --keyserver keyserver.ubuntu.com --recv 3B4FE6ACC0B21F32
gpg --export --armor 3B4FE6ACC0B21F32 | apt-key add -
apt-get update

image

- 再次查看默认安装的mysql数据库版本,可以看到默认的已经变成了mysql5.7的版本了。

apt-cache policy mysql-serverimage

四、安装mysql数据库

apt-get -y install mysql-server-5.7

## 查看mysql是否安装成功
1.dpkg -l | grep mysql
2.mysql -V
3.systemctl status mysql

image

- 设置开启自启

systemctl enable mysql

五、修改mysql root密码和换回apt源

1. 修改mysql数据库密码

# 此时无需密码即可进入
mysql

# 修改密码
use mysql;
alter user root@'localhost' identified with mysql_native_password by "12345678";
flush privileges;

2. 更换apt源

cd /etc/apt
mv sources.list sources.list.old
mv sources.list.back  sources.list
apt-get update

至此mysql5.7数据库安装完成。

标签:multiverse,mysql5.7,ubuntu,apt,22.04,mysql,main,com
From: https://www.cnblogs.com/wltian-one/p/17767082.html

相关文章

  • ubuntu禁用图形界面
    1,查询默认的启动级别:systemctrlget-default2,设置命令行模式:systemctrlset-defaultmulti-user.target3,设置图形模式:systemctlset-defaultgraphical.target ......
  • 华为云Ubuntu安装合集
    华为云Ubuntu安装yumsudoapt-getinstallyumaliasyum='sudoapt-get'安装宝塔面板wikijshexo安装hexoinit失败gittortoisegittortoisegit使用......
  • [Ubuntu 20.04] 修复‘systemd-shutdown[1]: waiting for process: crond’需等待1分
    由于在2020-2021年期间下载过Linux版本的FreeDownloadManager(简称FDM,一款免费但不开源的跨平台下载工具),而该软件的官网被挂了木马,因此在此期间下载安装过FDM的Linux用户,其定时任务crond中都被挂上了木马。具体现象为,关机时需要等待1分30秒,系统显示‘systemd-shutdown[1]:waiti......
  • ORBSLAM3 安装及测试教程(Ubuntu20.04)
    1.准备工作1.1安装依赖sudoaptinstallgitcmakegccg++mlocate1.2下载ORBSLAM3源码可以去Github下载源码:https://github.com/UZ-SLAMLab/ORB_SLAM3或者终端内下载:gitclonehttps://github.com/UZ-SLAMLab/ORB_SLAM3.git2.安装Pangolin可以去Github下载源......
  • ubuntu安装docker
    在Ubuntu上安装Docker非常简单。按照以下步骤进行操作:更新系统软件包列表:CopyCodesudoaptupdate安装必要的软件包,以便使用HTTPS源进行下载:CopyCodesudoaptinstallapt-transport-httpsca-certificatescurlsoftware-properties-common添加Docker官方的GPG......
  • Ubuntu下Tiny6410 嵌入式 Qt 开发环境的搭建
    原文:https://www.pianshen.com/article/73721187848/Ubuntu下Tiny6410嵌入式Qt开发环境的搭建首先要准备好交叉编译所需要的软件包:(1)arm-linux-gcc-4.5.1-v6-vfp-20101103.tgz(交叉编译环境)(2)qt-everywhere-opensource-src-4.8.5.tar.gz(Qt的源码)(3)qt-creator-linux-x86_64-ope......
  • ubuntu 安装cp210x驱动
    目录驱动包下载编译安装驱动包下载下载Linux版本需要先注册账号编译安装#查看内核版本uname-rmake(yourcp210xdriver)cpcp210x.koto/lib/modules/<kernel-version>/kernel/drivers/usb/serialinsmod/lib/modules/<kernel-version/kernel/drivers/usb/serial......
  • Ubuntu18.04下使用PHP7.2的连接sql server数据库
     一、简介SQLServer是由Microsoft开发和推广的关系数据库管理系统(DBMS),它最初是由Microsoft、Sybase和Ashton-Tate三家公司共同开发的,并于1988年推出了第一个OS/2版本。MicrosoftSQLServer近年来不断更新版本,1996年,Microsoft推出了SQLServer6.5版本;1998年,SQLServer7.0版本......
  • ubuntu18.04环境下编译支持debuginfod的gdb
    ubuntu18.04环境下编译支持debuginfod的gdb介绍Ubuntu22.10版本才默认安装debuginfod,对于之前的发行版都需要手动配置。gdb从10.1版本才开始支持debuginfod,而Ubuntu旧的发行版里gdb都低于10.1版本。另外,debuginfod被包含在elfutils里面,且从elfutils-0.178版本后才支持,而Ubuntu......
  • 启动wsl ubuntu 报错
    解决方案:1、管理员打开PwoerShell2、输入Enable-WindowsOptionalFeature-Online-FeatureNameMicrosoft-Windows-Subsystem-Linux(如下图所示)  ......