这篇文章主要介绍了如何使用yum方式安装mysql5.7 on linux_64,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。

1.下载并安装RPM
https://dev.mysql.com/downloads/repo/yum/
rpm -ivh mysql57-community-release-el6-11.noarch.rpm

2.确认安装成功

点击(此处)折叠或打开

# yum repolist enabled | grep "mysql.*-community.*"

This system is not registered with RHN.

RHN support will be disabled.

http://repo.mysql.com/yum/mysql-connectors-community/el/6/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - ""

Trying other mirror.

mysql-connectors-community MySQL Connectors Community 0

mysql-tools-community MySQL Tools Community 0

mysql57-community MySQL 5.7 Community Server 0

3.选择安装程序
编辑文件/etc/yum.repos.d/mysql-community.repo,将想安装的版本条目enable=1

点击(此处)折叠或打开

[mysql57-community]

name=MySQL 5.7 Community Server

baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/

enabled=0

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

点击(此处)折叠或打开

# yum repolist enabled | grep mysql

This system is not registered with RHN.

RHN support will be disabled.

mysql57-community MySQL 5.7 Community Server 237


4.确保连接至internet

点击(此处)折叠或打开

[root@mysql1 network-scripts]# cat ifcfg-eth0

DEVICE="eth0"

HWADDR="00:0C:29:68:EC:D8"

NM_CONTROLLED="yes"

ONBOOT="yes"

BOOTPROTO=none

IPADDR=192.168.1.200

NETMASK=255.255.255.0

GATEWAY=192.168.1.1

[root@mysql1 network-scripts]# cat /etc/resolv.conf

nameserver 114.114.114.114

nameserver 8.8.8.8

nameserver 192.168.0.1

点击(此处)折叠或打开

curl http://repo.mysql.com/yum/mysql-5.6-community/el/6/x86_64/repodata/repomd.xml


5.安装mysql

点击(此处)折叠或打开

# yum install mysql-community-server

Loaded plugins: rhnplugin

This system is not registered with RHN.

RHN support will be disabled.

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package mysql-community-server.x86_64 0:5.7.21-1.el6 set to be updated

--> Processing Dependency: mysql-community-common(x86-64) = 5.7.21-1.el6 for package: mysql-community-server-5.7.21-1.el6.x86_64

--> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.21-1.el6.x86_64

--> Processing Dependency: perl(strict) for package: mysql-community-server-5.7.21-1.el6.x86_64

--> Processing Dependency: perl(POSIX) for package: mysql-community-server-5.7.21-1.el6.x86_64

--> Processing Dependency: perl(Getopt::Long) for package: mysql-community-server-5.7.21-1.el6.x86_64

--> Processing Dependency: perl(File::Path) for package: mysql-community-server-5.7.21-1.el6.x86_64

--> Processing Dependency: libnuma.so.1(libnuma_1.2)(64bit) for package: mysql-community-server-5.7.21-1.el6.x86_64

--> Processing Dependency: libnuma.so.1(libnuma_1.1)(64bit) for package: mysql-community-server-5.7.21-1.el6.x86_64

--> Processing Dependency: /usr/bin/perl for package: mysql-community-server-5.7.21-1.el6.x86_64

--> Processing Dependency: libnuma.so.1()(64bit) for package: mysql-community-server-5.7.21-1.el6.x86_64

--> Running transaction check

---> Package mysql-community-client.x86_64 0:5.7.21-1.el6 set to be updated

--> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.21-1.el6.x86_64

---> Package mysql-community-common.x86_64 0:5.7.21-1.el6 set to be updated

---> Package numactl.x86_64 0:2.0.3-9.el6 set to be updated

---> Package perl.x86_64 4:5.10.1-115.el6 set to be updated

--> Processing Dependency: perl-libs = 4:5.10.1-115.el6 for package: 4:perl-5.10.1-115.el6.x86_64

--> Processing Dependency: perl(version) for package: 4:perl-5.10.1-115.el6.x86_64

--> Processing Dependency: perl-libs for package: 4:perl-5.10.1-115.el6.x86_64

--> Processing Dependency: perl(Pod::Simple) for package: 4:perl-5.10.1-115.el6.x86_64

--> Processing Dependency: perl(Module::Pluggable) for package: 4:perl-5.10.1-115.el6.x86_64

--> Processing Dependency: libperl.so()(64bit) for package: 4:perl-5.10.1-115.el6.x86_64

--> Running transaction check

---> Package mysql-community-libs.x86_64 0:5.7.21-1.el6 set to be updated

---> Package perl-Module-Pluggable.x86_64 1:3.90-115.el6 set to be updated

---> Package perl-Pod-Simple.x86_64 1:3.13-115.el6 set to be updated

--> Processing Dependency: perl(Pod::Escapes) >= 1.04 for package: 1:perl-Pod-Simple-3.13-115.el6.x86_64

---> Package perl-libs.x86_64 4:5.10.1-115.el6 set to be updated

---> Package perl-version.x86_64 3:0.77-115.el6 set to be updated

--> Running transaction check

---> Package perl-Pod-Escapes.x86_64 1:1.04-115.el6 set to be updated

--> Finished Dependency Resolution


Dependencies Resolved


==============================================================================================================================================================================================================================================================================

Package Arch Version Repository Size

==============================================================================================================================================================================================================================================================================

Installing:

mysql-community-server x86_64 5.7.21-1.el6 mysql57-community 152 M

Installing for dependencies:

mysql-community-client x86_64 5.7.21-1.el6 mysql57-community 23 M

mysql-community-common x86_64 5.7.21-1.el6 mysql57-community 329 k

mysql-community-libs x86_64 5.7.21-1.el6 mysql57-community 2.1 M

numactl x86_64 2.0.3-9.el6 test 55 k

perl x86_64 4:5.10.1-115.el6 test 10 M

perl-Module-Pluggable x86_64 1:3.90-115.el6 test 36 k

perl-Pod-Escapes x86_64 1:1.04-115.el6 test 29 k

perl-Pod-Simple x86_64 1:3.13-115.el6 test 208 k

perl-libs x86_64 4:5.10.1-115.el6 test 576 k

perl-version x86_64 3:0.77-115.el6 test 48 k


Transaction Summary

==============================================================================================================================================================================================================================================================================

Install 11 Package(s)

Upgrade 0 Package(s)


Total download size: 189 M

Installed size: 919 M

Is this ok [y/N]: y

Downloading Packages:

(1/11): mysql-community-client-5.7.21-1.el6.x86_64.rpm | 23 MB 00:09

(2/11): mysql-community-common-5.7.21-1.el6.x86_64.rpm | 329 kB 00:00

(3/11): mysql-community-libs-5.7.21-1.el6.x86_64.rpm | 2.1 MB 00:01

(4/11): mysql-community-server-5.7.21-1.el6.x86_64.rpm | 152 MB 03:16

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Total 925 kB/s | 189 MB 03:28

warning: rpmts_HdrFromFdno: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

mysql57-community/gpgkey | 54 kB 00:00 ...

Importing GPG key 0x5072E1F5 "MySQL Release Engineering " from /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

Is this ok [y/N]: y

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Installing : mysql-community-common-5.7.21-1.el6.x86_64 1/11

Installing : mysql-community-libs-5.7.21-1.el6.x86_64 2/11

Installing : mysql-community-client-5.7.21-1.el6.x86_64 3/11

Installing : 1:perl-Pod-Escapes-1.04-115.el6.x86_64 4/11

Installing : 3:perl-version-0.77-115.el6.x86_64 5/11

Installing : 4:perl-libs-5.10.1-115.el6.x86_64 6/11

Installing : 1:perl-Pod-Simple-3.13-115.el6.x86_64 7/11

Installing : 1:perl-Module-Pluggable-3.90-115.el6.x86_64 8/11

Installing : 4:perl-5.10.1-115.el6.x86_64 9/11

Installing : numactl-2.0.3-9.el6.x86_64 10/11

Installing : mysql-community-server-5.7.21-1.el6.x86_64 11/11


Installed:

mysql-community-server.x86_64 0:5.7.21-1.el6


Dependency Installed:

mysql-community-client.x86_64 0:5.7.21-1.el6 mysql-community-common.x86_64 0:5.7.21-1.el6 mysql-community-libs.x86_64 0:5.7.21-1.el6 numactl.x86_64 0:2.0.3-9.el6 perl.x86_64 4:5.10.1-115.el6 perl-Module-Pluggable.x86_64 1:3.90-115.el6

perl-Pod-Escapes.x86_64 1:1.04-115.el6 perl-Pod-Simple.x86_64 1:3.13-115.el6 perl-libs.x86_64 4:5.10.1-115.el6 perl-version.x86_64 3:0.77-115.el6


Complete!

启动服务

点击(此处)折叠或打开

[root@mysql1 yum.repos.d]# service mysqld start

Initializing MySQL database: [ OK ]

Starting mysqld: [ OK ]

[root@mysql1 yum.repos.d]# service mysqld status

mysqld (pid 1628) is running..


6.修改root密码
-获得root初识密码

点击(此处)折叠或打开

]# grep 'temporary password' /var/log/mysqld.log

2018-02-25T22:53:03.372590Z 1 [Note] A temporary password is generated for root@localhost: +(LVH%nyg1vC

- 登录root
# mysql -uroot -p

-修改root密码

点击(此处)折叠或打开

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

Query OK, 0 rows affected (0.01 sec)

点击(此处)折叠或打开

Grant all privileges on *.* to 'root'@'%' identified by 'MyNewPass4!' with grant option;

flush privileges;

感谢你能够认真阅读完这篇文章,希望小编分享的“如何使用yum方式安装mysql5.7 on linux_64”这篇文章对大家有帮助,同时也希望大家多多支持亿速云,关注亿速云行业资讯频道,更多相关知识等着你来学习!