mysql 5.7安装*****
MySQL
依赖 MySQL 依赖 libaio,所以先要安装 libaio
yum search libaio # 检索相关信息
yum install libaio # 安装依赖包
检查 MySQL 是否已安装
yum list installed | grep mysql
如果有,就先全部卸载,命令如下
yum -y remove mysql-libs.x86_64
下载 MySQL Yum Repository
wget
如果提示-bash: wget: 未找到命令,请先...
*****
MySQL
依赖 MySQL 依赖 libaio,所以先要安装 libaio
yum search libaio # 检索相关信息
yum install libaio # 安装依赖包
检查 MySQL 是否已安装
yum list installed | grep mysql
如果有,就先全部卸载,命令如下
yum -y remove mysql-libs.x86_64
下载 MySQL Yum Repository
wget
如果提示-bash: wget: 未找到命令,请先执行 yum install wget 安装 wget
安装
添加 MySQL Yum Repository
yum localinstall mysql-community-release-el7-5.noarch.rpm
[root@glpit01 software]# yum -y localinstall
mysql-community-release-el7-5.noarch.rpm
Loaded plugins: fastestmirror, langpacks
Examining mysql-community-release-el7-5.noarch.rpm: mysql-community-release-el7-5.noarch
Marking mysql-community-release-el7-5.noarch.rpm to be installed
Resolving Dependencies
--> Running Transaction check
---> package mysql-community-release.noarch 0:el7-5 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================== ============
package Arch Version Repository Size
============================================================================== ============
Installing:
mysql-community-release noarch el7-5
/mysql-community-release-el7-5.noarch 4.3 k
Transaction Summary
==============================================================================
============
Install 1 package
Total size: 4.3 k
Installed size: 4.3 k
Downloading packages:
Running Transaction check
Running Transaction test
Transaction test succeeded
Running transaction
Installing : MySQL-community-release-el7-5.noarch 1/1
Verifying : MySQL-community-release-el7-5.noarch 1/1
Installed:
mysql-community-release.noarch 0:el7-5
Complete!
验证下是否添加成功
yum repolist enabled | grep "mysql.*-community.*"
[root@glpit01 software]# yum repolist enabled | grep
"mysql.*-community.*"
mysql-connectors-community/x86_64 MySQL Connectors Community
30
mysql-tools-community/x86_64 MySQL Tools Community
43
mysql56-community/x86_64 MySQL 5.6 Community Server
306
选择要启用 MySQL 版本(可以看到 5.5, 5.7 版本是默认禁用的,因为现在最新的稳定版是 5.6)
yum repolist all | grep mysql
[root@glpit01 software]# yum repolist all | grep mysql
mysql-connectors-community/x86_64 MySQL Connectors Community
enabled: 30
mysql-connectors-community-source MySQL Connectors Community - So
disabled
mysql-tools-community/x86_64 MySQL Tools Community
enabled: 43
mysql-tools-community-source MySQL Tools Community - Source
disabled
mysql55-community/x86_64 MySQL 5.5 Community Server
disabled
mysql55-community-source MySQL 5.5 Community Server - So
disabled
MySQL56-community/x86_64 MySQL 5.6 Community Server enabled: 306
mysql56-community-source MySQL 5.6 Community Server - So disabled
mysql57-community-dmr/x86_64 MySQL 5.7 Community Server Deve disabled
mysql57-community-dmr-source MySQL 5.7 Community Server Deve disabled
可以通过类似下面的语句来启动某些版本
yum-config-manager --disable mysql56-community
yum-config-manager --enable mysql57-community-dmr
或者通过修改 /etc/yum.repos.d/mysql-community.repo 文件
# Enable to use MySQL 5.6
[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=$basearch/
enabled=1
gpgcheck=1
gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
其中 enabled=0 是指禁用,enabled=1 指启用。
注意:任何时候,只能启用一个版本。
执行
yum repolist enabled | grep mysql
查看当前的启动的 MySQL 版本
[root@bogon software]# yum repolist enabled | grep mysql
mysql-connectors-community/x86_64 MySQL Connectors Community 14
mysql-tools-community/x86_64 MySQL Tools Community 17
mysql56-community/x86_64 MySQL 5.6 Community Server 139
通过 Yum 来安装 MySQL
执行
yum -y install mysql-community-server
[root@glpit01 software]# yum -y install mysql-community-server
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.zju.edu.cn
* extras: mirrors.zju.edu.cn
* updates: mirrors.zju.edu.cn
Resolving Dependencies
--> Running Transaction check
---> package MySQL-community-server.x86_64 0:5.6.35-2.el7 will be installed
--> Processing Dependency: MySQL-community-common(x86-64) = 5.6.35-2.el7 for package: mysql-community-server-5.6.35-2.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 5.6.10 for package: mysql-community-server-5.6.35-2.el7.x86_64
--> Processing Dependency: perl(DBI) for package:
mysql-community-server-5.6.35-2.el7.x86_64
--> Running Transaction check
---> Package mysql-community-client.x86_64 0:5.6.35-2.el7 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.6.10 for package: mysql-community-client-5.6.35-2.el7.x86_64
---> Package mysql-community-common.x86_64 0:5.6.35-2.el7 will be installed
---> Package perl-DBI.x86_64 0:1.627-4.el7 will be installed
--> Processing Dependency: perl(RPC::PlServer) >= 0.2001 for package: perl-DBI-1.627-4.el7.x86_64
--> Processing Dependency: perl(RPC::PlClient) >= 0.2000 for package: perl-DBI-1.627-4.el7.x86_64
--> Running Transaction check
---> Package mariadb-libs.x86_64 1:5.5.40-1.el7_0 will be obsoleted
---> Package mysql-community-libs.x86_64 0:5.6.35-2.el7 will be obsoleting
---> Package perl-PlRPC.noarch 0:0.2020-14.el7 will be installed
--> Processing Dependency: perl(Net::Daemon) >= 0.13 for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Net::Daemon::Test) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Net::Daemon::Log) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Compress::Zlib) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Running transaction check
---> Package perl-IO-Compress.noarch 0:2.061-2.el7 will be installed
--> Processing Dependency: perl(Compress::Raw::Zlib) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
--> Processing Dependency: perl(Compress::Raw::Bzip2) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
---> Package perl-Net-Daemon.noarch 0:0.48-5.el7 will be installed
--> Running transaction check
---> Package perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 will be installed
---> Package perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================
============
package Arch Version Repository Size
==============================================================================
============
Installing:
MySQL-community-libs x86_64 5.6.35-2.el7 MySQL56-community 2.0 M
replacing mariadb-libs.x86_64 1:5.5.40-1.el7_0
mysql-community-server x86_64 5.6.35-2.el7 mysql56-community 59 M
Installing for dependencies:
mysql-community-client x86_64 5.6.35-2.el7 mysql56-community 19 M
mysql-community-common x86_64 5.6.35-2.el7 mysql56-community 257 k
perl-Compress-Raw-Bzip2 x86_64 2.061-3.el7
base 32 k
perl-Compress-Raw-Zlib x86_64 1:2.061-4.el7
base 57 k
perl-DBI x86_64 1.627-4.el7
base 802 k
perl-IO-Compress noarch 2.061-2.el7
base 260 k
perl-Net-Daemon noarch 0.48-5.el7
base 51 k
perl-PlRPC noarch 0.2020-14.el7
base 36 k
Transaction Summary
==============================================================================
============
Install 2 packages (+8 Dependent packages)
Total download size: 82 M
Downloading packages:
warning:
/var/cache/yum/x86_64/7/mysql56-community/packages/mysql-community-common-5.6.35-2.el7
.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Public key for mysql-community-common-5.6.35-2.el7.x86_64.rpm
is not installed
(1/10): mysql-community-common-5.6.35-2.el7.x86_64.rpm
| 257 kB 00:00:01
(2/10): MySQL-community-libs-5.6.35-2.el7.x86_64.rpm
| 2.0 MB 00:00:04
(3/10): perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm
| 32 kB 00:00:00
(4/10): perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm
| 57 kB 00:00:00
(5/10): perl-IO-Compress-2.061-2.el7.noarch.rpm
| 260 kB 00:00:00
(6/10): perl-Net-Daemon-0.48-5.el7.noarch.rpm
| 51 kB 00:00:00
(7/10): perl-PlRPC-0.2020-14.el7.noarch.rpm
| 36 kB 00:00:00
(8/10): perl-DBI-1.627-4.el7.x86_64.rpm
| 802 kB 00:00:00
(9/10): mysql-community-server-5.6.35-2.el7.x86_64.rpm
| 59 MB 00:02:33
(10/10): mysql-community-client-5.6.35-2.el7.x86_64.rpm
| 19 MB 00:11:18
------------------------------------------------------------------------------
------------
Total 124
kB/s | 82 MB 00:11:18
Retrieving key from file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Importing GPG key 0x5072E1F5:
Userid : "MySQL Release Engineering
"
Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
package : mysql-community-release-el7-5.noarch
(@/mysql-community-release-el7-5.noarch)
From : file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Running Transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : mysql-community-common-5.6.35-2.el7.x86_64 1/11
Installing : mysql-community-libs-5.6.35-2.el7.x86_64 2/11
Installing : mysql-community-client-5.6.35-2.el7.x86_64 3/11
Installing : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 4/11
Installing : perl-Net-Daemon-0.48-5.el7.noarch 5/11
Installing : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 6/11
Installing : perl-IO-Compress-2.061-2.el7.noarch
7/11
Installing : perl-PlRPC-0.2020-14.el7.noarch 8/11
Installing : perl-DBI-1.627-4.el7.x86_64 9/11
Installing : MySQL-community-server-5.6.35-2.el7.x86_64 10/11
Erasing : 1:mariadb-libs-5.5.40-1.el7_0.x86_64 11/11
Verifying : mysql-community-client-5.6.35-2.el7.x86_64 1/11
Verifying : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 2/11
Verifying : perl-Net-Daemon-0.48-5.el7.noarch 3/11
Verifying : mysql-community-libs-5.6.35-2.el7.x86_64 4/11
Verifying : mysql-community-common-5.6.35-2.el7.x86_64 5/11
Verifying : perl-PlRPC-0.2020-14.el7.noarch 6/11
Verifying : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 7/11
Verifying : perl-DBI-1.627-4.el7.x86_64 8/11
Verifying : perl-IO-Compress-2.061-2.el7.noarch 9/11
Verifying : mysql-community-server-5.6.35-2.el7.x86_64 10/11
Verifying : 1:mariadb-libs-5.5.40-1.el7_0.x86_64 11/11
Installed:
mysql-community-libs.x86_64 0:5.6.35-2.el7
mysql-community-server.x86_64 0:5.6.35-2.el7
Dependency Installed:
mysql-community-client.x86_64 0:5.6.35-2.el7
mysql-community-common.x86_64 0:5.6.35-2.el7
perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7
perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7
perl-DBI.x86_64 0:1.627-4.el7
perl-IO-Compress.noarch 0:2.061-2.el7
perl-Net-Daemon.noarch 0:0.48-5.el7
perl-PlRPC.noarch 0:0.2020-14.el7
Replaced:
mariadb-libs.x86_64 1:5.5.40-1.el7_0
Complete!
执行
rpm -qi MySQL-community-server.x86_64 0:5.6.24-3.el7
[root@glpit01 software]# rpm -qi mysql-community-server.x86_64 0:5.6.24-3.el7
Name : mysql-community-server
Version : 5.6.35
Release : 2.el7
Architecture: x86_64
Install Date: Thu 09 Mar 2017 11:01:32 AM CST
Group : Applications/Databases
Size : 261997088
License : Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Under GPLv2 license as shown in the Description field.
Signature : DSA/SHA1, Tue 29 Nov 2016 02:47:43 PM CST, Key ID 8c718d3b5072e1f5
Source RPM : mysql-community-5.6.35-2.el7.src.rpm
Build Date : Tue 29 Nov 2016 07:14:39 AM CST
Build Host : siv27.no.oracle.com
Relocations : (not relocatable)
packager : MySQL Release Engineering
Vendor : Oracle and/or its affiliates
URL :
Summary : A very fast and reliable SQL database server
Description :
The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
and robust SQL (Structured Query Language) database server. MySQL Server
is intended for mission-critical, heavy-load production systems as well
as for embedding into mass-deployed software. MySQL is a trademark of
Oracle and/or its affiliates
The MySQL software has Dual Licensing, which means you can use the MySQL
software free of charge under the GNU General Public License
(). You can also purchase commercial MySQL
licenses from Oracle and/or its affiliates if you do not wish to be bound by the terms of
the GPL. See the chapter "Licensing and Support" in the manual for
further info.
The MySQL web site () provides the latest news and
information about the MySQL software. Also please see the documentation
and the manual for more information.
This package includes the MySQL server binary as well as related utilities
to run and administer a MySQL server.
package 0:5.6.24-3.el7 is not installed
执行
whereis mysql
可以看到 MySQL 的安装目录是 /usr/bin/
启动MySQL服务
[root@glpit01 software]# systemctl start mysqld
开机启动
[root@glpit01 software]# systemctl enable mysqld
[root@glpit01 software]# systemctl daemon-reload
5.6 直接输入mysql进入并设置访问规则
mysql> set password for 'root'@'localhost'=password('Passw0rd');
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Passw0rd' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)
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> select user,host from user;
+------+-----------+
| user | host |
+------+-----------+
| root | % |
| root | 127.0.0.1 |
| root | ::1 |
| | glpit01 |
| root | glpit01 |
| | localhost |
| root | localhost |
+------+-----------+
7 rows in set (0.00 sec)
MySQL> select user,host from user where host <> '%'; +------+-----------+
| user | host |
+------+-----------+
| root | 127.0.0.1 |
| root | ::1 |
| | glpit01 |
| root | glpit01 |
| | localhost |
| root | localhost |
+------+-----------+
6 rows in set (0.00 sec)
mysql> delete from user where host <> '%';
Query OK, 6 rows affected (0.00 sec)
mysql> select user,host from user;
+------+------+
| user | host |
+------+------+
| root | % |
+------+------+
1 row in set (0.00 sec)
mysql>
本文档为【mysql 5.7安装】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。