加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

yum60秒内安装mysql的方法

发布时间:2020-12-15 23:05:05 所属栏目:安全 来源:网络整理
导读:一、前言 直接“yum -y install mysql”安装mysql,你会发现,安装的是MariaDB,并且默认是5.5版本,因此如果我们想控制版本,而需要下面的方法 二、安装epel仓库 yum -y install epel-release 三、手动创建mysql的yum源 [[email?protected] ~]# cd /etc/yum
一、前言

直接“yum -y install mysql”安装mysql,你会发现,安装的是MariaDB,并且默认是5.5版本,因此如果我们想控制版本,而需要下面的方法

二、安装epel仓库

yum -y install epel-release

三、手动创建mysql的yum源

[[email?protected] ~]# cd /etc/yum.repos.d/
[[email?protected] yum.repos.d]# vim mysq.repo

[mysql-connectors-community]
name=MySQL Connectors Community
baseurl=http://repo.mysql.com/yum/mysql-connectors-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

[mysql-tools-community]
name=MySQL Tools Community
baseurl=http://repo.mysql.com/yum/mysql-tools-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

[mysql-tools-preview]
name=MySQL Tools Preview
baseurl=http://repo.mysql.com/yum/mysql-tools-preview/el/7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

[mysql-cluster-7.5-community]
name=MySQL Cluster 7.5 Community
baseurl=http://repo.mysql.com/yum/mysql-cluster-7.5-community/el/7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

[mysql-cluster-7.6-community]
name=MySQL Cluster 7.6 Community
baseurl=http://repo.mysql.com/yum/mysql-cluster-7.6-community/el/7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

四、安装mysql

[[email?protected] yum.repos.d]# yum -y install mysql-community-server

五、参看版本

[[email?protected] yum.repos.d]# mysql -V
mysql Ver 14.14 Distrib 5.7.24,for Linux (x86_64) using EditLine wrapper

六、启动数据库,查看初始化密码

[[email?protected] yum.repos.d]# systemctl start mysqld
[[email?protected] yum.repos.d]# cat /var/log/mysqld.log | grep [email?protected]
2019-01-01T11:10:13.006233Z 1 [Note] A temporary password is generated for [email?protected]: Nkw6Uma<!p-q

七、修改密码

[[email?protected] yum.repos.d]# mysqladmin -uroot -p‘Nkw6Uma<!p-q‘ password 9qlHZ%cymysqladmin: [Warning] Using a password on the command line interface can be insecure.Warning: Since password will be sent to server in plain text,use ssl connection to ensure password safety.//秘钥要符合复杂性要求,不能小于8位

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读