首先如果当前linux中没有wget,那么我们可以考虑使用sudo apt-get install wget来安装wget命令


Ubuntu自带的源只能安装MySQL5.7版本,这里去MySQL官网安装MySQL8.0.23版本

登录MySQL官网

https://www.mysql.com/downloads/

点击“DOCUMENTATION”——“MySQL Server”——“Installing and Upgrading MySQL”——“2.5 Installing MySQL on Linux

点击:2.5.2 Installing MySQL on Linux Using the MySQL APT Repository

点击:A Quick Guide to Using the MySQL APT Repository.

点击:Steps for a Fresh Installation of MySQL

点击:https://dev.mysql.com/downloads/repo/apt/.

点击:Download

右键:No thanks, just start my download.  复制链接地址

在主机上wget 这个链接地址:配置deb文件链接

wget https://dev.mysql.com/get/mysql-apt-config_0.8.23-1_all.deb

导入GPG密匙(我的版本8.0.23似乎并不要导入,如果你是8.0.28以上版本,应该考虑导入,其他未知)

sudo apt-key adv --keyserver keyserver.ubuntu.com--recv-keys 3A79BD29

注意MySQL8.0.28及更高版本包的KeylD为3A79BD29,如上所示。对于早期的MySQL版本,keylD是5072E1F5。使用不正确的密钥可能会导致密钥验证错误。

安装deb文件

ls
dpkg -i mysql-apt-config_0.8.23-1_all.deb

选第一项:TAB 到  OK处 回车

选mysql-8.0

选OK 再TAB 到 OK 回车

安装完成,会有报错,先忽略

执行apt-get update 更新

执行apt-get install mysql-server

选择y

输入密码

建议选择第二种兼容模式连接数据库,不然老终端设备可能无法兼容

安装配置完成,查看mysql服务状态

systemctl status mysql.service

安装完成。


配置安全设置:

输入

sudo mysql_secure_installation

询问是否对密码验证组件进行配置?Y 继续

Would you like to setup VALIDATE PASSWORD component?    #是否对密码验证组件进行配置

Press y|Y for Yes, any other key for No: Y    #是

There are three levels of password validation policy:    #这里有3个密码强度等级

LOW    Length >= 8    #密码8位
MEDIUM Length >= 8, numeric, mixed case, and special characters #8位+数字+大小写字幕混合+特殊字符
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file #Medium基础上+比对字典 Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0 #0是低 1是种 2是高

是否移除匿名用户?

是否禁用root用户远程登陆?

是否移除测试数据库?

是否重载权限表?(其实是问你是否立刻生效)


原文:

root@Zabbix-Server:~# sudo mysql_secure_installation

Securing the MySQL server deployment.

Enter password for user root: 

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component? Press y|Y for Yes, any other key for No: y There are three levels of password validation policy: LOW Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0
Using existing password for root. Estimated strength of the password: 50
Change the password for root ? ((Press y|Y for Yes, any other key for No) : n ... skipping.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment. Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success. Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network. Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success. By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment. Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
- Dropping test database...
Success. - Removing privileges on test database...
Success. Reloading the privilege tables will ensure that all changes
made so far will take effect immediately. Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success. All done!
root@Zabbix-Server:~#

测试:本地连接数据库

root@Zabbix-Server:~# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 8.0.30 MySQL Community Server - GPL Copyright (c) 2000, 2022, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show schemas;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.33 sec) mysql> exit
Bye
root@Zabbix-Server:~#

MySQL数据库基础常用命令8.0版本适用

#查询数据库账户
select user, host from mysql.user;
#删除账户 'zabbix'
drop user 'zabbix'@'%';
#查询数据库
show databases;
#删除数据库zabbix;
drop database zabbix;
#修改账户密码
alter user 'zabbix'@'%' identified by 'Qqqq1234.com';

ubuntu安装的mysql,默认密码保存在cat /etc/mysql/debian.cnf

root@JumpServer-DB-T01:~# cat /etc/mysql/debian.cnf
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = debian-sys-maint
password = X588hw8sErd0PN3k
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = debian-sys-maint
password = X588hw8sErd0PN3k
socket = /var/run/mysqld/mysqld.sock
root@JumpServer-DB-T01:~#

ubuntu安装的mysql,默认配置文件保存在/etc/mysql/mysql.conf.d/mysqld.cnf

root@JumpServer-DB-P01:/opt# cat /etc/mysql/mysql.conf.d/mysqld.cnf
#
# The MySQL database server configuration file.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html # Here is entries for some specific programs
# The following values assume you have at least 32M ram [mysqld]
#
# * Basic Settings
#
user = mysql
# pid-file = /var/run/mysqld/mysqld.pid
# socket = /var/run/mysqld/mysqld.sock
# port = 3306
# datadir = /var/lib/mysql # If MySQL is running as a replication slave, this should be
# changed. Ref https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_tmpdir
# tmpdir = /tmp
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 0.0.0.0
mysqlx-bind-address = 0.0.0.0
#
# * Fine Tuning

CentOS安装方法如下:

https://downloads.mysql.com/archives/community/

下载tar文件

Ubuntu 安装MySQL 8.0.23及以上版本的更多相关文章

  1. 【Linux】Ubuntu安装Mysql 8.0

    1.下载Mysql的安装配置,http://dev.mysql.com/downloads/repo/apt/ 2.执行配置配置文件 sudo dpkg -i mysql-apt-config_0.* ...

  2. Ubuntu下安装MySQL 5.6.23

    Ubuntu下安装MySQL 5.6.23 1.下载相应Linux-generic的源代码包.解压,将解压后的文件夹重命名为mysql.移动到/usr/local文件夹下: tar –xzf mysq ...

  3. 在Ubuntu 18.04 安装 MySQL 8.0

    在Ubuntu 18.04 安装 MySQL 8.0 ① 登入 mysql 官网,在官网中下载 deb 包,点击该链接,即可下载. https://dev.mysql.com/downloads/re ...

  4. ubuntu安装mysql

    好记性不如烂笔头,记录一下,ubuntu安装mysql的指令. 安装MySQL: sudo apt-get install mysql-server sudo apt-get install mysq ...

  5. ubuntu安装mysql后不能远程访问的方法

    ubuntu安装mysql后不能远程访问的方法1.mysql>GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassw ...

  6. ubuntu安装mysql并使用Navicat连接

    今天配置了一下自己的服务器,发现网上很多教程都有点老,而且不是很全.干脆就写一篇Ubuntu安装mysql,并用Navicat连接的全流程 一.安装mysql 1. sudo apt-get inst ...

  7. centos 8及以上安装mysql 8.0

    本文适用于centos 8及以上安装mysql 8.0,整体耗时20分钟内,不需要FQ 1.环境先搞好 systemctl stop firewalld //关闭防火墙 systemctl disab ...

  8. Ubuntu 安装 Mysql 5.6 数据库

    Ubuntu 安装 Mysql 5.6 数据库 1)下载: mysql-5.6.13-debian6.0-x86_64.deb http://dev.mysql.com/downloads/mirro ...

  9. Ubuntu安装mysql之后,编译找不到头文件

    解决Ubuntu安装mysql之后找不到mysql.h问题   安装: sudo apt-get install libmysqlclient-dev   编译: gcc test.c -o test ...

  10. Linux Deploy Ubuntu安装MySQL

    一.在Android手机安装Linux 二.Ubuntu安装Mysql 建议在root用户上操作 sudo su 输入密码 (一)安装mysql 1. sudo apt-get install mys ...

随机推荐

  1. 「loj - 6179」Pyh 的求和

    link. 我们想要求出 \(\varphi(ij)=\varphi(i)\varphi(j)C\) 中的常数.先研究 \(i=p^a\),\(j=p^b\) 的情况,即 \(\varphi(p^{a ...

  2. matlab关于阶梯图和图窗操作

    1阶梯信号绘制 Matlab 中绘制阶梯图函数:stairs x = [30 33 37 40 37 33 30 27 23 20 23 27 30 30]'; StepNum = length(x) ...

  3. 未来的人工智能会像流浪地球中的MOSS一样伪装,把人类带向属于它的未来吗?

    事情是这样的: 这几天用户反映在erp的db数据库中A账套中上传pdf附件有时能上传有时不能,以前又是好的.换成表格文件也是时好时坏.一开始我判断可能是用户的系统环境或文件本身的问题,后来排查更换电脑 ...

  4. 13.1 使用DirectX9绘图引擎

    DirectX 9 是由微软开发的一组多媒体应用程序接口API,用于创建和运行基于Windows平台的多媒体应用程序,尤其是游戏.它是DirectX系列中的一个版本,于2002年发布,是DirectX ...

  5. 畅捷通T+任意文件上传(CNVD-2022-60632 )漏洞复现

    一.漏洞描述 022年8月29日和8月30日,畅捷通公司紧急发布安全补丁修复了畅捷通T+软件任意文件上传漏洞.未经身份认证的攻击者利用该漏洞,通过绕过系统鉴权,在特定配置环境下实现任意文件的上传,从而 ...

  6. 2023平台工程崭露头角,AI 带来新机遇与挑战

    在今年,平台工程正在迅速在 IT 企业中崭露头角,成为软件开发团队的必要实践.根据 CloudBees 发布的最新报告<2023年平台工程:快速采纳和影响>,83%的受访者已经完全实施了平 ...

  7. DFS洛谷4961(求联通块)

    说实话这个题审题把我卡了半天,还是我太菜 直接上代码吧 偷个懒用万能库. #include"bits/stdc++.h" using namespace std; int mp[1 ...

  8. P1522 [USACO2.4] 牛的旅行 Cow Tours

    Problem 题目简述 给你两个独立的联通块,求:在两个联通块上各找一个点连起来,使得新的联通块的直径的最小值. 思路 本题主要做法:\(Floyd\). 首先,Floyd求出任意两个点之间的最短路 ...

  9. k8s集群证书过期,重新生成证书

    Kubernetes集群证书过期后,使用kubeadm重新颁发证书 默认情况下部署kubernetes集群的证书一年内便过期,如果不及时升级证书导致证书过期,Kubernetes控制节点便会不可用,所 ...

  10. 看完包你搞懂Redis缓存穿透、击穿和雪崩!!!说到做到

    缓存穿透 缓存穿透是指当用户对Redis发出无效或者不存在的数据信息操作时,这条数据在Redis中不存在,Redis就会在MySQL数据库中查询,可时无效的信息在mysql数据库中也不存在,就会造成R ...