当前位置:网站首页>05-ubuntu安装mysql8
05-ubuntu安装mysql8
2022-06-24 06:57:00 【weixin_46371752】
一:下载MySQL APT安装配置包
wget https://dev.mysql.com/get/mysql-apt-config_0.8.14-1_all.deb
二:安装MySQL
1、输入以下命令,进入安装:
sudo dpkg -i mysql-apt-config_0.8.14-1_all.deb
2、上下键选择 ok ,回车
安装MySQL Server
1、更新apt软件源
sudo apt-get update
2、安装mysql Server
sudo apt-get install mysql-server
2.1、我出现了报错:
W: GPG 错误:http://repo.mysql.com/apt/ubuntu bionic InRelease: 由于没有公钥,无法验证下列签名: NO_PUBKEY 467B942D3A79BD29
E: 仓库 “http://repo.mysql.com/apt/ubuntu bionic InRelease” 没有数字签名。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
2.2、解决方法:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 467B942D3A79BD29
#后面那一串字符串:是W:GPG报错下的 NO_PUBKEY 467B942D3A79BD29
2.3、再次安装mysql server : sudo apt-get install mysql-server
3、出现下面的,说明我们安装的不是mysql8版本的,安装的是mysql 5.7.38【如果不想使用MySQL5.7版本,跳到步骤5】
正在设置 mysql-server (5.7.38-0ubuntu0.18.04.1) ...
正在处理用于 libc-bin (2.27-3ubuntu1.5) 的触发器 ...
正在处理用于 systemd (237-3ubuntu10.52) 的触发器 ...
正在处理用于 man-db (2.8.3-2ubuntu0.1) 的触发器 ...
正在处理用于 ureadahead (0.100.0-21) 的触发器 ...
4、此时想进入MySQL中;安装成功后是随机密码,需要修改密码。
查看MySQL版本:mysql -V
进入MySQL客户端:mysql -uroot -p
报错:ERROR 1698 (28000): Access denied for user 'root'@'localhost'
4报错的解决方法,因为是生成随机密码了,需要修改密码。
4.1、进入配置文件,设置不用密码登录
sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
到[mysqld] 下 加入:skip-grant-tables
保存退出:wq
重启mysql服务:service mysql restart
4.2、进入MySQL,设置密码
1、进入MySQL客户端
mysql -uroot -p
不用输入密码,直接回车
2、执行
use mysql;
update user set authentication_string=password("[email protected]"),plugin='mysql_native_password' where user='root';
flush privilegs;
3、修改mysql配置文件,把不用输入密码进入那一句删除。
sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
将[mysqld] 下的 skip-grant-tables 注释或删除
4、重启mysql
service mysql restart
4.3、重新进入MySQL客户端
mysql -uroot [email protected]
进入到MySQL后,创建数据库试试
create database test_db;
5、如果不想要mysql5.7.38,需要先卸载,再安装mysql8版本
5.1、卸载mysql5.7版本
1、查看mysql的依赖项:
dpkg --list|grep mysql
2、卸载
sudo apt-get remove mysql-common
3、卸载(最后数字根据自己下载的版本,通过mysql -V查看)
sudo apt-get autoremove --purge mysql-server-5.7
选择删除存在的数据库
4、清理残留数据
dpkg -l|grep ^rc|awk '{print$2}'|sudo xargs dpkg -P
5、验证:再次查看依赖项,无显示出来,清理干净
dpkg --list|grep mysql
若有其他内容执行:sudo apt-get autoremove --purge mysql-apt-config
再dpkg --list|grep mysql 查看依赖项
6、安装MyS5QL8.0
6.1、下载mysql包
wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb
6.2、安装
sudo dpkg -i mysql-apt-config_0.8.13-1_all.deb
6.3、更新软件源
sudo apt update
6.4、安装MySQL8
sudo apt install mysql-server
6.5、设置root密码,通过下箭头,选择确定,回车
6.6、网上的教程中看到默认的mysql8.0的加密方式与ubuntu18.04 不兼容,所以选择5.x的加密方式;建议选择下边的那个:
选择 (Retain MYSQL 5.x Compatibility) 后,点击回车,执行
6.7、看到是下面的,安装的就是mysql8了
正在设置 mysql-server (8.0.29-1ubuntu18.04) ...
正在处理用于 man-db (2.8.3-2ubuntu0.1) 的触发器 ...
正在处理用于 libc-bin (2.27-3ubuntu1.5) 的触发器 ...
7、进入mysql客户端进行验证
1、查看mysql版本
mysql -V
2、进入MySQl客户端
mysql -uroot [email protected]
边栏推荐
- For a detailed explanation of flex:1, flex:1
- 快速读论文----AD-GCL:Adversarial Graph Augmentation to Improve Graph Contrastive Learning
- All you know is the test pyramid?
- LINQ 查询(2)
- JDBC 在性能测试中的应用
- 复习SGI STL二级空间配置器(内存池) | 笔记自用
- Saccadenet: use corner features to fine tune the two stage prediction frame | CVPR 2020
- 工控机防破解
- Interview tutorial - multi thread knowledge sorting
- Opening chapter of online document technology - rich text editor
猜你喜欢

Leetcode 207: course schedule (topological sorting determines whether the loop is formed)

Solve the problem of notebook keyboard disabling failure

Ad-gcl:advantageous graph augmentation to improve graph contractual learning

The first exposure of Alibaba cloud's native security panorama behind the only highest level in the whole domain

SCM stm32f103rb, BLDC DC motor controller design, schematic diagram, source code and circuit scheme

2021-03-16 COMP9021第九节课笔记

Graphmae ---- quick reading of papers
![[nilm] non intrusive load decomposition module nilmtk installation tutorial](/img/d0/bc5ea1cbca9ee96a2fe168484ffec4.png)
[nilm] non intrusive load decomposition module nilmtk installation tutorial

OC Extension 检测手机是否安装某个App(源码)

Swift 基礎 閉包/Block的使用(源碼)
随机推荐
MySQL source and target table row count check
1-4metaploitable2 introduction
Auto usage example
GraphMAE----论文快速阅读
Part 1: building OpenGL environment
Selenium IDE的安装以及使用
Opening chapter of online document technology - rich text editor
Vulnhub target: boredhackerblog: social network
Question 1: the container that holds the most water
WCF TCP protocol transmission
Interview tutorial - multi thread knowledge sorting
In the post epidemic era, the home service robot industry has just set sail
os.path.join()使用过程中遇到的坑
Four models of iPhone 13 series have been exposed, and indeed, they are 13 fragrant!
More than observation | Alibaba cloud observable suite officially released
487. 最大连续1的个数 II ●●
decltype用法介绍
June 27, 2021: given a positive array arr, it represents the weight of several people
Solution of electric education system for intelligent supervision station
About the iframe anchor, the anchor is offset up and down, and the anchor has page display problems Srcdoc problem of iframe