阿里云Centos7使用yum安装MySQL5.6的正确姿势

[[email protected] ~]# rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Retrieving http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-release-el7-5    ################################# [100%]
[[email protected] ~]# yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community/x86_64 MySQL Connectors Community                  42
mysql-tools-community/x86_64      MySQL Tools Community                       51
mysql56-community/x86_64          MySQL 5.6 Community Server                 344
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]# yum -y install mysql-community-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.6.37-2.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.6.37-2.el7 for package: mysql-community-server-5.6.37-2.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 5.6.10 for package: mysql-community-server-5.6.37-2.el7.x86_64
--> Processing Dependency: perl(Data::Dumper) for package: mysql-community-server-5.6.37-2.el7.x86_64
--> Processing Dependency: perl(DBI) for package: mysql-community-server-5.6.37-2.el7.x86_64
--> Running transaction check
---> Package mariadb.x86_64 1:5.5.52-1.el7 will be obsoleted
---> Package mysql-community-client.x86_64 0:5.6.37-2.el7 will be obsoleting
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.6.10 for package: mysql-community-client-5.6.37-2.el7.x86_64
---> Package mysql-community-common.x86_64 0:5.6.37-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
---> Package perl-Data-Dumper.x86_64 0:2.145-3.el7 will be installed
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.52-1.el7 will be obsoleted
---> Package mysql-community-libs.x86_64 0:5.6.37-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-client                    x86_64                   5.6.37-2.el7                     mysql56-community                    19 M
     replacing  mariadb.x86_64 1:5.5.52-1.el7
 mysql-community-libs                      x86_64                   5.6.37-2.el7                     mysql56-community                   2.0 M
     replacing  mariadb-libs.x86_64 1:5.5.52-1.el7
 mysql-community-server                    x86_64                   5.6.37-2.el7                     mysql56-community                    59 M
Installing for dependencies:
 mysql-community-common                    x86_64                   5.6.37-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-Data-Dumper                          x86_64                   2.145-3.el7                      base                                 47 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  3 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.37-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Public key for mysql-community-common-5.6.37-2.el7.x86_64.rpm is not installed
(1/11): mysql-community-common-5.6.37-2.el7.x86_64.rpm                                                                  | 257 kB  00:00:00
(2/11): mysql-community-libs-5.6.37-2.el7.x86_64.rpm                                                                    | 2.0 MB  00:00:01
(3/11): perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm                                                                  |  32 kB  00:00:00
(4/11): perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm                                                                   |  57 kB  00:00:00
(5/11): perl-Data-Dumper-2.145-3.el7.x86_64.rpm                                                                         |  47 kB  00:00:00
(6/11): perl-IO-Compress-2.061-2.el7.noarch.rpm                                                                         | 260 kB  00:00:00
(7/11): perl-Net-Daemon-0.48-5.el7.noarch.rpm                                                                           |  51 kB  00:00:00
(8/11): perl-PlRPC-0.2020-14.el7.noarch.rpm                                                                             |  36 kB  00:00:00
(9/11): perl-DBI-1.627-4.el7.x86_64.rpm                                                                                 | 802 kB  00:00:00
(10/11): mysql-community-client-5.6.37-2.el7.x86_64.rpm                                                                 |  19 MB  00:00:07
(11/11): mysql-community-server-5.6.37-2.el7.x86_64.rpm                                                                 |  59 MB  00:00:16
-----------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                          4.2 MB/s |  82 MB  00:00:19
Retrieving key from file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Importing GPG key 0x5072E1F5:
 Userid     : "MySQL Release Engineering <[email protected]>"
 Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
 Package    : mysql-community-release-el7-5.noarch (installed)
 From       : file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : mysql-community-common-5.6.37-2.el7.x86_64                                                                                 1/13
  Installing : perl-Data-Dumper-2.145-3.el7.x86_64                                                                                        2/13
  Installing : mysql-community-libs-5.6.37-2.el7.x86_64                                                                                   3/13
  Installing : mysql-community-client-5.6.37-2.el7.x86_64                                                                                 4/13
  Installing : perl-Net-Daemon-0.48-5.el7.noarch                                                                                          5/13
  Installing : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64                                                                                6/13
  Installing : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64                                                                                 7/13
  Installing : perl-IO-Compress-2.061-2.el7.noarch                                                                                        8/13
  Installing : perl-PlRPC-0.2020-14.el7.noarch                                                                                            9/13
  Installing : perl-DBI-1.627-4.el7.x86_64                                                                                               10/13
  Installing : mysql-community-server-5.6.37-2.el7.x86_64                                                                                11/13
  Erasing    : 1:mariadb-5.5.52-1.el7.x86_64                                                                                             12/13
  Erasing    : 1:mariadb-libs-5.5.52-1.el7.x86_64                                                                                        13/13
  Verifying  : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64                                                                                 1/13
  Verifying  : perl-Data-Dumper-2.145-3.el7.x86_64                                                                                        2/13
  Verifying  : perl-IO-Compress-2.061-2.el7.noarch                                                                                        3/13
  Verifying  : mysql-community-libs-5.6.37-2.el7.x86_64                                                                                   4/13
  Verifying  : mysql-community-common-5.6.37-2.el7.x86_64                                                                                 5/13
  Verifying  : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64                                                                                6/13
  Verifying  : mysql-community-server-5.6.37-2.el7.x86_64                                                                                 7/13
  Verifying  : perl-Net-Daemon-0.48-5.el7.noarch                                                                                          8/13
  Verifying  : perl-DBI-1.627-4.el7.x86_64                                                                                                9/13
  Verifying  : mysql-community-client-5.6.37-2.el7.x86_64                                                                                10/13
  Verifying  : perl-PlRPC-0.2020-14.el7.noarch                                                                                           11/13
  Verifying  : 1:mariadb-5.5.52-1.el7.x86_64                                                                                             12/13
  Verifying  : 1:mariadb-libs-5.5.52-1.el7.x86_64                                                                                        13/13 

Installed:
  mysql-community-client.x86_64 0:5.6.37-2.el7    mysql-community-libs.x86_64 0:5.6.37-2.el7    mysql-community-server.x86_64 0:5.6.37-2.el7   

Dependency Installed:
  mysql-community-common.x86_64 0:5.6.37-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-Data-Dumper.x86_64 0:2.145-3.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.x86_64 1:5.5.52-1.el7                                       mariadb-libs.x86_64 1:5.5.52-1.el7                                      

Complete!
[[email protected] ~]# systemctl enable mysqld
[[email protected] ~]# systemctl start mysqld
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we‘ll need the current
password for the root user.  If you‘ve just installed MySQL, and
you haven‘t set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)
Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
 ... Success!

Normally, root should only be allowed to connect from ‘localhost‘.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y
 ... Success!

By default, MySQL comes with a database named ‘test‘ that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
ERROR 1008 (HY000) at line 1: Can‘t drop database ‘test‘; database doesn‘t exist
 ... Failed!  Not critical, keep moving...
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... Success!

All done!  If you‘ve completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

Cleaning up...
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 5.6.37 MySQL Community Server (GPL)

Copyright (c) 2000, 2017, 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> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)

mysql> 

http://www.cnblogs.com/XBlack/p/5178758.html

时间: 2024-10-11 22:56:16

阿里云Centos7使用yum安装MySQL5.6的正确姿势的相关文章

阿里云Centos7使用yum安装MySQL5.6.24的正确姿势

阿里云Centos7使用yum安装MySQL5.6.24 阿里云Centos7使用yum安装MySQL5.6.24 前言:由于某些不可抗力,我要在自己的阿里云服务器上搭建hadoop+hive+mysql+tomcat环境,下为mysql的安装记录 →_→大家都知道,centos自带的repo是不会自动更新每个软件的最新版本,所以无法通过yum方式安装MySQL的高级版本.所以,即使我使劲用yum -y install mysql mysql-server mysql-devel,也是没有人会鸟

阿里云centos7.3下安装mysql5.7.19

17年5月18趁着打折买了3年的阿里云的服务器,快大半年了基本没怎么动估计快长毛了,今天一时兴起想跑个项目安装了大半天的mysql网上找了好多都不顶用,故写一篇记录一下以便不时之需. 1.准备安装材料(假设已经有了环境了,包括客户端工具) centos版本: mysql版本:  5.7.19(目前官网最新版 https://dev.mysql.com/downloads/mysql/) 操作系统选择 版本选择 2.准备centos安装环境 centos7以上版本默认会安装MariaDB以下的会默

阿里云 CentOS7.4 环境安装mysql5.7

1. 删除默认安装的数据库,无所谓的请略过 据说CentOS7.x版本会默认安装mariadb数据库,我有点强迫症,故卸载之: rpm -qa|grep mariadb yum remove mariadb-libs.x86_64 遇到 "Is this ok [y/N]:",输入"y", 命令跑完会看到 "complete!". 2.安装mysql 5.7:当前所在目录是 root根目录 下载MySQL官方的 Yum Repository wg

阿里云centos7使用yum安装mysql的正确姿势

yum快速安装mysql 新增yum源 rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm 查看可用的mysql版本(直接略过) yum repolist enabled | grep "mysql.*-community.*" 导入 yum -y install mysql-community-server 加入开机启动 systemctl enable mysqld 启动mysql s

CentOS7使用yum安装mysql5.7

提前说一下,网速不好不要用yum安装,等得时间太长. 第一步.获取yum源 [[email protected] ~]# rpm -ivh https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql57-community-release-el7-10.noarch.rpm 获取https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql57-communit

阿里云CentOS7系列一 -- 安装JDK7的方法.

最近因为数据采集以及生产环境冲突.导入windows Server 2008系统经常死机.经讨论决定把采集服务程序和生产服务进行分开.采集程序通过windows Server2008运行.而生产程序通过Linux 来运行. 阿里云提供通过云端安装tomcat.jdk 等组建的命令.但是我自己测试安装可几遍总是有问题.无奈只有自己去下载对应的安装包来安装.这样做也是有好处的.可以自己指定安装文件目录.闲话不多少直接上干货: 会用到的相关安装包的共享连接: 1 JDK7 安装包: http://yu

centos7使用yum安装mysql5.6版本

1.检查系统中是否已安装 MySQL. rpm -qa | grep mysql 返回空值的话,就说明没有安装 MySQL .注意:在新版本的CentOS7中,默认的数据库已更新为了Mariadb,而非 MySQL,所以执行 yum install mysql 命令只是更新Mariadb数据库,并不会安装 MySQL .2.查看已安装的 Mariadb 数据库版本. rpm -qa|grep -i mariadb 3.卸载已安装的 Mariadb 数据库. rpm -qa|grep mariad

CentOS7下yum安装mysql5.6

由于CentOS7默认的数据库yum源切换成了MariaDB,需要手动设置yum源才可安装mysql. 1.安装yum源 # rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm 2.检测可用的yum源 # yum repolist enabled | grep "mysql.*-community.*" mysql-connectors-community/x86_64 MySQL Con

Centos7通过yum安装Mysql5.7

yum安装mysql (新版本CentOS自带mariadb而不是mysql,所以要先卸载了,否则会冲突) 查找mariadb rpm -qa | grep mariadb 卸载mariadb rpm -e --nodeps mariadb-libs-5.5.52-1.el7.x86_64 安装mysql依赖 yum install vim libaio net-tools 下载mysql源 wget http://repo.mysql.com/yum/mysql-5.7-community/e