首页 > 数据库 >yum在线安装mysql

yum在线安装mysql

时间:2022-12-18 22:00:45浏览次数:58  
标签:39 x86 db 00 yum mysql 64 在线

下载

https://dev.mysql.com/downloads/repo/yum/

上传服务器

$ rz -E
rz waiting to receive.
$ ll
总用量 12
-rw-r--r-- 1 root root 11288 5月   1 14:17 mysql80-community-release-el7-6.noarch.rpm

安装yum源

$ rpm -ivh mysql80-community-release-el7-6.noarch.rpm 
警告:mysql80-community-release-el7-6.noarch.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:mysql80-community-release-el7-6  ################################# [100%]         
$ ll /etc/yum.repos.d/mysql-community*
-rw-r--r-- 1 root root 1147 4月   8 18:00 /etc/yum.repos.d/mysql-community-debuginfo.repo
-rw-r--r-- 1 root root 2062 4月   8 18:00 /etc/yum.repos.d/mysql-community.repo
-rw-r--r-- 1 root root 2132 4月   8 18:00 /etc/yum.repos.d/mysql-community-source.repo

修改yum源

要安装5.7版本的还需要启用5.7的yum源

$ vim /etc/yum.repos.d/mysql-community.repo
# Enable to use MySQL 5.7
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch
#打开5.7的
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
       file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

[mysql80-community]
name=MySQL 8.0 Community Server
baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/7/$basearch
#关闭8.0的
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
       file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
       
#或者直接用sed修改
$ sed -ri -e '2,7s/^(enabled=).*$/\11/'  -e '10,16s/^(enabled=).*$/\10/' -e '2,7s/^(gpgcheck=).*$/\10/' /etc/yum.repos.d/mysql-community.repo

清缓存,重建元数据

$ yum makecache fast
已加载插件:fastestmirror, langpacks
Determining fastest mirrors
epel/x86_64/metalink                                                                                                                  | 8.4 kB  00:00:00     
 * base: mirrors.aliyun.com
 * epel: hkg.mirror.rackspace.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
 * webtatic: us-east.repo.webtatic.com
base                                                                   | 3.6 kB  00:00:00     
development                                                            | 3.6 kB  00:00:00     
epel                                                                   | 4.7 kB  00:00:00     
extras                                                                 | 2.9 kB  00:00:00     
hxgepel                                                                | 4.7 kB  00:00:00     
mysql-connectors-community                                             | 2.6 kB  00:00:00     
mysql-tools-community                                                  | 2.6 kB  00:00:00     
mysql57-community                                                      | 2.6 kB  00:00:00     
updates                                                                | 2.9 kB  00:00:00     
webtatic                                                               | 3.6 kB  00:00:00     
(1/39): base/7/x86_64/group_gz                                         | 153 kB  00:00:00     
(2/39): base/7/x86_64/filelists_db                                     | 7.2 MB  00:00:00     
(3/39): base/7/x86_64/primary_db                                       | 6.1 MB  00:00:01     
(4/39): base/7/x86_64/other_db                                         | 2.6 MB  00:00:01     
(5/39): development/7/x86_64/group_gz                                  | 153 kB  00:00:01     
(6/39): development/7/x86_64/primary_db                                | 6.1 MB  00:00:43     
(7/39): epel/x86_64/group_gz                                           |  96 kB  00:00:00     
(8/39): epel/x86_64/filelists_db                                       |  12 MB  00:00:01     
(9/39): epel/x86_64/updateinfo                                         | 1.0 MB  00:00:00     
(10/39): epel/x86_64/prestodelta                                       |  838 B  00:00:00     
(11/39): epel/x86_64/primary_db                                        | 7.0 MB  00:00:00     
(12/39): epel/x86_64/other_db                                          | 3.4 MB  00:00:00     
(13/39): extras/7/x86_64/primary_db                                    | 246 kB  00:00:00     
(14/39): extras/7/x86_64/other_db                                      | 147 kB  00:00:00     
(15/39): extras/7/x86_64/filelists_db                                  | 277 kB  00:00:00     
(16/39): hxgepel/7/x86_64/group_gz                                     |  96 kB  00:00:00     
(17/39): hxgepel/7/x86_64/updateinfo                                   | 1.0 MB  00:00:00     
(18/39): hxgepel/7/x86_64/prestodelta                                  |  838 B  00:00:00     
(19/39): development/7/x86_64/filelists_db                             | 7.2 MB  00:00:50     
(20/39): hxgepel/7/x86_64/primary_db                                   | 7.0 MB  00:00:02     
(21/39): hxgepel/7/x86_64/filelists_db                                 |  12 MB  00:00:03     
(22/39): hxgepel/7/x86_64/other_db                                     | 3.4 MB  00:00:01     
(23/39): mysql-connectors-community/x86_64/primary_db                  |  87 kB  00:00:01     
(24/39): mysql-connectors-community/x86_64/other_db                    |  23 kB  00:00:00     
(25/39): mysql-tools-community/x86_64/primary_db                       |  86 kB  00:00:01     
(26/39): mysql-tools-community/x86_64/other_db                         |  16 kB  00:00:00     
(27/39): mysql-tools-community/x86_64/filelists_db                     | 325 kB  00:00:02     
(28/39): mysql-connectors-community/x86_64/filelists_db                |  35 kB  00:00:04     
(29/39): mysql57-community/x86_64/primary_db                           | 306 kB  00:00:00     
(30/39): updates/7/x86_64/filelists_db                                 | 8.2 MB  00:00:00     
(31/39): updates/7/x86_64/other_db                                     | 1.0 MB  00:00:00     
(32/39): mysql57-community/x86_64/other_db                             |  82 kB  00:00:00     
(33/39): updates/7/x86_64/primary_db                                   |  15 MB  00:00:01     
(34/39): webtatic/x86_64/group_gz                                      |  448 B  00:00:01     
(35/39): mysql57-community/x86_64/filelists_db                         | 1.8 MB  00:00:04     
(36/39): webtatic/x86_64/primary_db                                    | 271 kB  00:00:02     
(37/39): development/7/x86_64/other_db                                 | 2.6 MB  00:00:16     
(38/39): webtatic/x86_64/other_db                                      |  72 kB  00:00:04     
(39/39): webtatic/x86_64/filelists_db                                  |  97 kB  00:00:09     
元数据缓存已建立              

安装数据库

$ yum install  mysql-server mysql mysql-common mysql-libs -y

检查配置文件

$ ll /etc/my.cnf
-rw-r--r-- 1 root root 960 3月  22 02:00 /etc/my.cnf
$ date
2022年 05月 01日 星期日 14:36:41 CST
#是最新的

启动服务

$ systemctl start mysqld

查看初始化密码

$ cat /var/log/mysqld.log | grep password
2022-05-01T06:38:29.550471Z 1 [Note] A temporary password is generated for root@localhost: sbBwl+wiG8ya

密码为sbBwl+wiG8ya

登录测试

$ mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.

mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

无法操作

修改密码

mysql> alter user 'root'@'localhost' identified by '111111';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> set password=password('111111');
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

mysql> alter user 'root'@'localhost' identified by 'Mysql@123';
Query OK, 0 rows affected (0.00 sec)

yum安装的mysql 密码不能太简单

可以通过修改数据库密码规则来解决

可以参考另一篇随笔 https://www.cnblogs.com/guangdelw/p/16991028.html

标签:39,x86,db,00,yum,mysql,64,在线
From: https://www.cnblogs.com/guangdelw/p/16991041.html

相关文章

  • MySQL发行版的选择
    MySQL官方发行版MySQL是最流行的数据库,主要特点:简单:MySQL使用很简单,任何稍微有IT背景的技术人员都可以无师自通地参照文档安装运行和使用MySQL,这几乎没有什么门槛。开......
  • 修改mysql密码规则
    建议个人测试学习使用,切勿在生产环境中使用--查看规则mysql>showvariableslike'validate_password%';+--------------------------------------+--------+|Variab......
  • cppconn cpp create table in cpp file ,show current date time in mysql cli via s
    //Model/mysqlhelper.h#ifndef__mysqlhelper_h__#define__mysqlhelper_h__#include<chrono>#include<ctime>#include<fstream>#include<iomanip>#include<i......
  • Mac 使用 brew 安装 mysql
    最近需要用到MySQL来开发项目,所以在Mac配置了下MySQL的环境。1、使用brewinstallmysql安装MySQL安装完毕后会有以下提示信息,告诉我们初始安装好后root账户......
  • centos7 编译安装mysql
    mysql5.7版本和8版本的编译略有不同,所以这里分开讲。源码编译、安装MySQL5.7Mysql5.7版本更新后有很多变化,最主要的变化是安装MySQL必须要有BOOST库,不过MySQL的官网源码......
  • MySQL HA(High Availability) 数据库高可用工具Orchestrator 基本原理
    目录1.实例探测(instancesdiscover/poll)2.故障分析(failureanalysis)3.故障恢复(failurerecovery)4.总结Orchestrator是一款开源的MySQL数据库高可用HA工具。它稳定可靠,......
  • 20篇MySQL文章,成体系跟新完毕,尽情学习吧!
    MySQL是对于数据分析师来说。很重要的一项技能。你可以不会python,但是你就是不能不会SQL,基本只要是招数据分析的岗位,就必须要你会使用SQL。基于此,我将自己的学习心得,整理成......
  • mysql count() 优化
    mysqlcount(*)优化通常情况下,分页接口一般会查询两次数据库,第一次是获取具体数据,第二次是获取总的记录行数,然后把结果整合之后,再返回。查询具体数据的sql,比如是这样的:......
  • Linux使用yum install报错:Disable the repository, so yum won't use it by default
     已加载插件:fastestmirror,langpacksOneoftheconfiguredrepositoriesfailed(未知),andyumdoesn'thaveenoughcacheddatatocontinue.Atthispointthe......
  • 深入解读MySQL InnoDB存储引擎Update语句执行过程
    参考b站up戌米的论文笔记https://www.bilibili.com/video/BV1Tv4y1o7tA/书籍《mysql是怎样运行的》极客时间《mysql实战45讲》系列文章目录和关于我一丶Mysql整体架......