Centos7.0安装Mysql5.7

前端之家收集整理的这篇文章主要介绍了Centos7.0安装Mysql5.7前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

[root@localhost soft]# rpm -qa | grep -i MysqL

MysqL-python-1.2.3-11.el7.x86_64

PHP-MysqL-5.4.16-36.1.el7_2.1.x86_64

[root@localhost soft]# yum -y remove MysqL-python

已加载插件:fastestmirror,langpacks

正在解决依赖关系

--> 正在检查事务

---> 软件包 MysqL-python.x86_64.0.1.2.3-11.el7 将被 删除

--> 解决依赖关系完成

依赖关系解决

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

Package 架构 版本 源 大小

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

正在删除:

MysqL-python x86_64 1.2.3-11.el7 @/MysqL-python-1.2.3-11.el7.x86_64 231 k

事务概要

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

移除 1 软件包

安装大小:231 k

Downloading packages:

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

正在删除 : MysqL-python-1.2.3-11.el7.x86_64 1/1

验证中 : MysqL-python-1.2.3-11.el7.x86_64 1/1

删除:

MysqL-python.x86_64 0:1.2.3-11.el7

完毕!

[root@localhost soft]# yum -y remove PHP-MysqL

已加载插件:fastestmirror,langpacks

正在解决依赖关系

--> 正在检查事务

---> 软件包 PHP-MysqL.x86_64.0.5.4.16-36.1.el7_2.1 将被 删除

--> 解决依赖关系完成

依赖关系解决

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

Package 架构 版本 源 大小

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

正在删除:

PHP-MysqL x86_64 5.4.16-36.1.el7_2.1 @updates 232 k

事务概要

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

移除 1 软件包

安装大小:232 k

Downloading packages:

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

正在删除 : PHP-MysqL-5.4.16-36.1.el7_2.1.x86_64 1/1

验证中 : PHP-MysqL-5.4.16-36.1.el7_2.1.x86_64 1/1

删除:

PHP-MysqL.x86_64 0:5.4.16-36.1.el7_2.1

完毕!

[root@localhost soft]# groupadd MysqL

[root@localhost soft]# useradd -r -g MysqL MysqL

[root@localhost soft]# yum install MysqL-community-{client,common,libs}-*

已加载插件:fastestmirror,langpacks

正在检查 MysqL-community-client-5.7.12-1.el7.x86_64.rpm: MysqL-community-client-5.7.12-1.el7.x86_64

MysqL-community-client-5.7.12-1.el7.x86_64.rpm 将被安装

正在检查 MysqL-community-common-5.7.12-1.el7.x86_64.rpm: MysqL-community-common-5.7.12-1.el7.x86_64

MysqL-community-common-5.7.12-1.el7.x86_64.rpm 将被安装

正在检查 MysqL-community-libs-5.7.12-1.el7.x86_64.rpm: MysqL-community-libs-5.7.12-1.el7.x86_64

MysqL-community-libs-5.7.12-1.el7.x86_64.rpm 将被安装

正在检查 MysqL-community-libs-compat-5.7.12-1.el7.x86_64.rpm: MysqL-community-libs-compat-5.7.12-1.el7.x86_64

MysqL-community-libs-compat-5.7.12-1.el7.x86_64.rpm 将被安装

正在解决依赖关系

--> 正在检查事务

---> 软件包 mariadb.x86_64.1.5.5.47-1.el7_2 将被 取代

---> 软件包 mariadb-libs.x86_64.1.5.5.47-1.el7_2 将被 取代

---> 软件包 MysqL-community-client.x86_64.0.5.7.12-1.el7 将被 舍弃

---> 软件包 MysqL-community-common.x86_64.0.5.7.12-1.el7 将被 安装

---> 软件包 MysqL-community-libs.x86_64.0.5.7.12-1.el7 将被 舍弃

---> 软件包 MysqL-community-libs-compat.x86_64.0.5.7.12-1.el7 将被 舍弃

--> 解决依赖关系完成

依赖关系解决

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

Package 架构 版本 源 大小

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

正在安装:

MysqL-community-client x86_64 5.7.12-1.el7 /MysqL-community-client-5.7.12-1.el7.x86_64 106 M

替换 mariadb.x86_64 1:5.5.47-1.el7_2

MysqL-community-common x86_64 5.7.12-1.el7 /MysqL-community-common-5.7.12-1.el7.x86_64 2.5 M

MysqL-community-libs x86_64 5.7.12-1.el7 /MysqL-community-libs-5.7.12-1.el7.x86_64 9.5 M

替换 mariadb-libs.x86_64 1:5.5.47-1.el7_2

MysqL-community-libs-compat x86_64 5.7.12-1.el7 /MysqL-community-libs-compat-5.7.12-1.el7.x86_64 9.2 M

替换 mariadb-libs.x86_64 1:5.5.47-1.el7_2

事务概要

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

安装 4 软件包

总计:127 M

Is this ok [y/d/N]: y

Downloading packages:

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

正在安装 : MysqL-community-common-5.7.12-1.el7.x86_64 1/6

正在安装 : MysqL-community-libs-5.7.12-1.el7.x86_64 2/6

正在安装 : MysqL-community-client-5.7.12-1.el7.x86_64 3/6

正在安装 : MysqL-community-libs-compat-5.7.12-1.el7.x86_64 4/6

正在删除 : 1:mariadb-5.5.47-1.el7_2.x86_64 5/6

正在删除 : 1:mariadb-libs-5.5.47-1.el7_2.x86_64 6/6

验证中 : MysqL-community-client-5.7.12-1.el7.x86_64 1/6

验证中 : MysqL-community-common-5.7.12-1.el7.x86_64 2/6

验证中 : MysqL-community-libs-5.7.12-1.el7.x86_64 3/6

验证中 : MysqL-community-libs-compat-5.7.12-1.el7.x86_64 4/6

验证中 : 1:mariadb-5.5.47-1.el7_2.x86_64 5/6

验证中 : 1:mariadb-libs-5.5.47-1.el7_2.x86_64 6/6

已安装:

MysqL-community-client.x86_64 0:5.7.12-1.el7 MysqL-community-common.x86_64 0:5.7.12-1.el7

MysqL-community-libs.x86_64 0:5.7.12-1.el7 MysqL-community-libs-compat.x86_64 0:5.7.12-1.el7

替代:

mariadb.x86_64 1:5.5.47-1.el7_2 mariadb-libs.x86_64 1:5.5.47-1.el7_2

完毕!

[root@localhost soft]#

[root@localhost soft]# rpm -qa | grep -i MysqL

MysqL-community-libs-compat-5.7.12-1.el7.x86_64

MysqL-community-common-5.7.12-1.el7.x86_64

MysqL-community-libs-5.7.12-1.el7.x86_64

MysqL-community-client-5.7.12-1.el7.x86_64

[root@localhost soft]# pwd

/soft

[root@localhost soft]# ll

总用量 1106888

-rwxr-xr-x. 1 root root 566722560 5月 21 10:25 MysqL-5.7.12-1.el7.x86_64.rpm-bundle.tar

-rwxr-xr-x. 1 7155 31415 24991304 3月 29 15:38 MysqL-community-client-5.7.12-1.el7.x86_64.rpm

-rwxr-xr-x. 1 7155 31415 276736 3月 29 15:38 MysqL-community-common-5.7.12-1.el7.x86_64.rpm

-rwxr-xr-x. 1 7155 31415 3786120 3月 29 15:38 MysqL-community-devel-5.7.12-1.el7.x86_64.rpm

-rwxr-xr-x. 1 7155 31415 45150068 3月 29 15:38 MysqL-community-embedded-5.7.12-1.el7.x86_64.rpm

-rwxr-xr-x. 1 7155 31415 23829224 3月 29 15:38 MysqL-community-embedded-compat-5.7.12-1.el7.x86_64.rpm

-rwxr-xr-x. 1 7155 31415 124953868 3月 29 15:39 MysqL-community-embedded-devel-5.7.12-1.el7.x86_64.rpm

-rwxr-xr-x. 1 7155 31415 2237968 3月 29 15:39 MysqL-community-libs-5.7.12-1.el7.x86_64.rpm

-rwxr-xr-x. 1 7155 31415 2115948 3月 29 15:39 MysqL-community-libs-compat-5.7.12-1.el7.x86_64.rpm

-rwxr-xr-x. 1 7155 31415 51016520 3月 29 15:40 MysqL-community-minimal-debuginfo-5.7.12-1.el7.x86_64.rpm

-rwxr-xr-x. 1 7155 31415 158252992 3月 29 15:40 MysqL-community-server-5.7.12-1.el7.x86_64.rpm

-rwxr-xr-x. 1 7155 31415 13998408 3月 29 15:41 MysqL-community-server-minimal-5.7.12-1.el7.x86_64.rpm

-rwxr-xr-x. 1 7155 31415 116098332 3月 29 15:41 MysqL-community-test-5.7.12-1.el7.x86_64.rpm

[root@localhost soft]# yum install MysqL-community-server

已加载插件:fastestmirror,langpacks

Loading mirror speeds from cached hostfile

* base: mirrors.neusoft.edu.cn

* extras: mirrors.yun-idc.com

* updates: mirrors.tuna.tsinghua.edu.cn

没有可用软件包 MysqL-community-server。

错误:无须任何处理

[root@localhost soft]# rpm -ivh MysqL-community-server-

MysqL-community-server-5.7.12-1.el7.x86_64.rpm MysqL-community-server-minimal-5.7.12-1.el7.x86_64.rpm

[root@localhost soft]# rpm -ivh MysqL-community-server-5.7.12-1.el7.x86_64.rpm

警告:MysqL-community-server-5.7.12-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature,密钥 ID 5072e1f5: NOKEY

准备中... ################################# [100%]

正在升级/安装...

1:MysqL-community-server-5.7.12-1.e################################# [100%]

[root@localhost soft]# rpm -ivh MysqL-community-devel-5.7.12-1.el7.x86_64.rpm

警告:MysqL-community-devel-5.7.12-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature,密钥 ID 5072e1f5: NOKEY

准备中... ################################# [100%]

正在升级/安装...

1:MysqL-community-devel-5.7.12-1.el################################# [100%]

[root@localhost soft]# rpm -qa | grep -i MysqL

MysqL-community-libs-compat-5.7.12-1.el7.x86_64

MysqL-community-common-5.7.12-1.el7.x86_64

MysqL-community-server-5.7.12-1.el7.x86_64

MysqL-community-libs-5.7.12-1.el7.x86_64

MysqL-community-devel-5.7.12-1.el7.x86_64

MysqL-community-client-5.7.12-1.el7.x86_64

[root@localhost soft]#

[root@localhost soft]# MysqL

ERROR 2002 (HY000): Can't connect to local MysqL server through socket '/var/lib/MysqL/MysqL.sock' (2)

[root@localhost soft]# MysqL -u MysqL -p -S /var/lib/MysqL/MysqL.sock

Enter password:

ERROR 2002 (HY000): Can't connect to local MysqL server through socket '/var/lib/MysqL/MysqL.sock' (2)

[root@localhost soft]# chown -R MysqL:MysqL /var/lib/MysqL

[root@localhost soft]# service MysqLd start

Redirecting to /bin/systemctl start MysqLd.service

[root@localhost soft]# ps -el | grep MysqLd

1 S 1001 6503 1 1 80 0 - 466720 poll_s ? 00:00:00 MysqLd

[root@localhost soft]# MysqL

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

[root@localhost soft]# MysqL -u root -p

Enter password:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

[root@localhost soft]# MysqLadmin -u root flush-privileges password "newpassword"

MysqLadmin: connect to server at 'localhost' Failed

error: 'Access denied for user 'root'@'localhost' (using password: NO)'

[root@localhost soft]# service MysqLd start

Redirecting to /bin/systemctl start MysqLd.service

[root@localhost soft]# grep 'temporary password' /var/log/MysqLd.log

2016-05-21T04:01:25.452939Z 1 [Note] A temporary password is generated for root@localhost: iM.OOzNGO3gG(临时密码)

[root@localhost soft]# MysqL -u root -p

Enter password:

Welcome to the MysqL monitor. Commands end with ; or \g.

Your MysqL connection id is 5

Server version: 5.7.12

Copyright (c) 2000,2016,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> ALTER USER 'root'@'localhost' IDENTIFIED BY '1qaz@WSX';

Query OK,0 rows affected (0.10 sec)

原文链接:https://www.f2er.com/centos/381337.html

猜你在找的CentOS相关文章