Centos8上yum安装mysql8
安装Yum Repository
[root@liujunjun ~]# wget https://repo.mysql.com//mysql80-community-release-el8-1.noarch.rpm --2020-12-08 08:06:16-- https://repo.mysql.com//mysql80-community-release-el8-1.noarch.rpm 正在解析主机 repo.mysql.com (repo.mysql.com)... 23.215.59.160 正在连接 repo.mysql.com (repo.mysql.com)|23.215.59.160|:443... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:30388 (30K) [application/x-redhat-package-manager] 正在保存至: “mysql80-community-release-el8-1.noarch.rpm” mysql80-community-release-el8-1.noarch.rp 100%[====================================================================================>] 29.68K 166KB/s 用时 0.2s 2020-12-08 08:06:17 (166 KB/s) - 已保存 “mysql80-community-release-el8-1.noarch.rpm” [30388/30388])
使用rpm来安装MySQL
[root@liujunjun ~]# rpm -ivh mysql80-community-release-el8-1.noarch.rpm 警告:mysql80-community-release-el8-1.noarch.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY Verifying... ################################# [100%] 准备中... ################################# [100%] 正在升级/安装... 1:mysql80-community-release-el8-1 ################################# [100%]
使用yum安装mysql服务
[root@liujunjun ~]# yum install mysql-server
启动服务
[root@liujunjun ~]# systemctl start mysqld [root@liujunjun ~]# systemctl enable mysqld.service Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service → /usr/lib/systemd/system/mysqld.service.
[root@liujunjun ~]# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8 Server version: 8.0.21 Source distribution Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. 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>
修改root密码
在MySQL 8.04前,执行:SET PASSWORD=PASSWORD(‘[新密码]’);但是MySQL8.0.4开始,这样默认是不行的。因为之前,MySQL的密码认证插件是“mysql_native_password”,而现在使用的是“caching_sha2_password”。
修改密码为123456(密码可以设置为任意值):
mysql> user mysql; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'user mysql' at line 1 mysql> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456'; Query OK, 0 rows affected (0.01 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.01 sec) mysql>
[root@liujunjun ~]# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9 Server version: 8.0.21 Source distribution Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. 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>
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2019-12-08 防火墙和iptables
2019-12-08 seq命令
2019-12-08 uniq命令
2019-12-08 grub2详解
2019-12-08 sort命令
2019-12-08 shell脚本--cut命令
2019-12-08 SHELL脚本--tr命令用法和特性全解