您的位置:首页 > 运维架构 > Linux

yum 方式在centos上 mysql 安装过程

2017-01-11 13:18 776 查看
按照网上的教程,实践了一遍。

必须能上网,其他的必要条件还不确定,我是安装了桌面版本的centos7.0

[root@localhost Tools]# 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%]

[root@localhost Tools]# ls

[root@localhost Tools]# yum repolist enabled | grep "mysql.*-community.*"

Existing lock /var/run/yum.pid: another copy is running as pid 41101.

Another app is currently holding the yum lock; waiting for it to exit...

  The other application is: PackageKit

    Memory : 152 M RSS (1.4 GB VSZ)

    Started: Tue Jan 10 19:40:51 2017 - 07:44 ago

    State  : Sleeping, pid: 41101

Another app is currently holding the yum lock; waiting for it to exit...

  The other application is: PackageKit

    Memory : 152 M RSS (1.4 GB VSZ)

    Started: Tue Jan 10 19:40:51 2017 - 07:46 ago

    State  : Sleeping, pid: 41101

Another app is currently holding the yum lock; waiting for it to exit...

  The other application is: PackageKit

    Memory : 152 M RSS (1.4 GB VSZ)

    Started: Tue Jan 10 19:40:51 2017 - 07:48 ago

    State  : Sleeping, pid: 41101

Another app is currently holding the yum lock; waiting for it to exit...

  The other application is: PackageKit

    Memory : 152 M RSS (1.4 GB VSZ)

    Started: Tue Jan 10 19:40:51 2017 - 07:50 ago

    State  : Sleeping, pid: 41101

Another app is currently holding the yum lock; waiting for it to exit...

  The other application is: PackageKit

    Memory : 152 M RSS (1.4 GB VSZ)

    Started: Tue Jan 10 19:40:51 2017 - 07:52 ago

    State  : Sleeping, pid: 41101

^C

Exiting on user cancel.

[root@localhost Tools]# rm -f /var/run/yum.pid

[root@localhost Tools]# yum repolist enabled | grep "mysql.*-community.*"

mysql-connectors-community/x86_64       MySQL Connectors Community           30

mysql-tools-community/x86_64            MySQL Tools Community                40

mysql56-community/x86_64                MySQL 5.6 Community Server          306

[root@localhost Tools]# yum -y install mysql-community-server

Loaded plugins: fastestmirror, langpacks

Loading mirror speeds from cached hostfile

 * base: mirror.bit.edu.cn

 * extras: mirrors.btte.net

 * updates: mirror.bit.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(Data::Dumper) 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

---> 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.35-3.el7 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.35-3.el7

 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-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  2 Packages (+9 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/11): mysql-community-common-5.6.35-2.el7.x86_64.rpm                                               | 257 kB  00:00:03     

(2/11): mysql-community-libs-5.6.35-2.el7.x86_64.rpm                                                 | 2.0 MB  00:00:45     

warning: /var/cache/yum/x86_64/7/base/packages/perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY

Public key for perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm is not installed

(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:01     

(6/11): perl-Net-Daemon-0.48-5.el7.noarch.rpm                                                        |  51 kB  00:00:00     

(7/11): perl-IO-Compress-2.061-2.el7.noarch.rpm                                                      | 260 kB  00:00:01     

(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:03     

(10/11): mysql-community-server-5.6.35-2.el7.x86_64.rpm                                              |  59 MB  00:07:03     

(11/11): mysql-community-client-5.6.35-2.el7.x86_64.rpm                                              |  19 MB  00:14:26     

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

Total                                                                                        97 kB/s |  82 MB  00:14:26     

Retrieving key from file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

Importing GPG key 0x5072E1F5:

 Userid     : "MySQL Release Engineering <mysql-build@oss.oracle.com>"

 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

Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

Importing GPG key 0xF4A80EB5:

 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"

 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5

 Package    : centos-release-7-0.1406.el7.centos.2.3.x86_64 (@anaconda)

 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

Warning: RPMDB altered outside of yum.

  Installing : mysql-community-common-5.6.35-2.el7.x86_64                                                              1/12 

  Installing : perl-Data-Dumper-2.145-3.el7.x86_64                                                                     2/12 

  Installing : mysql-community-libs-5.6.35-2.el7.x86_64                                                                3/12 

  Installing : mysql-community-client-5.6.35-2.el7.x86_64                                                              4/12 

  Installing : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64                                                             5/12 

  Installing : perl-Net-Daemon-0.48-5.el7.noarch                                                                       6/12 

  Installing : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64                                                              7/12 

  Installing : perl-IO-Compress-2.061-2.el7.noarch                                                                     8/12 

  Installing : perl-PlRPC-0.2020-14.el7.noarch                                                                         9/12 

  Installing : perl-DBI-1.627-4.el7.x86_64                                                                            10/12 

  Installing : mysql-community-server-5.6.35-2.el7.x86_64                                                             11/12 

  Erasing    : 1:mariadb-libs-5.5.35-3.el7.x86_64                                                                     12/12 

  Verifying  : mysql-community-client-5.6.35-2.el7.x86_64                                                              1/12 

  Verifying  : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64                                                              2/12 

  Verifying  : perl-Net-Daemon-0.48-5.el7.noarch                                                                       3/12 

  Verifying  : perl-Data-Dumper-2.145-3.el7.x86_64                                                                     4/12 

  Verifying  : mysql-community-libs-5.6.35-2.el7.x86_64                                                                5/12 

  Verifying  : mysql-community-common-5.6.35-2.el7.x86_64                                                              6/12 

  Verifying  : perl-PlRPC-0.2020-14.el7.noarch                                                                         7/12 

  Verifying  : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64                                                             8/12 

  Verifying  : perl-DBI-1.627-4.el7.x86_64                                                                             9/12 

  Verifying  : perl-IO-Compress-2.061-2.el7.noarch                                                                    10/12 

  Verifying  : mysql-community-server-5.6.35-2.el7.x86_64                                                             11/12 

  Verifying  : 1:mariadb-libs-5.5.35-3.el7.x86_64                                                                     12/12 

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-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-libs.x86_64 1:5.5.35-3.el7                                                                                        

Complete!

[root@localhost Tools]# systemctl enable mysqld

[root@localhost Tools]# systemctl start mysqld

[root@localhost Tools]# 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): 

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

Enter current password for root (enter for none): 

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

Unable to connect to the server as root user, giving up.

Cleaning up...

[root@localhost Tools]# 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): 

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

Enter current password for root (enter for none): 

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

Unable to connect to the server as root user, giving up.

Cleaning up...

[root@localhost Tools]# 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): 

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...

[root@localhost Tools]# 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: