1.
[root@mysql-serv ~]# cat <<EOF >> /etc/yum.repos.d/mysql-community.repo
[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/7/$basearch/
enabled=1
gpgcheck=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
EOF


2.
[root@mysql-serv ~]# yum repolist enabled |grep mysql
!mysql56-community/x86_64             MySQL 5.6 Community Server             434


3.
[root@mysql-serv ~]# yum install mysql-community-server
Loaded plugins: langpacks, ulninfo
mysql56-community                                                                                                                                                      | 2.5 kB  00:00:00
mysql56-community/x86_64/primary_db                                                                                                                                    | 191 kB  00:00:00
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.6.40-2.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.6.40-2.el7 for package: mysql-community-server-5.6.40-2.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 5.6.10 for package: mysql-community-server-5.6.40-2.el7.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.6.40-2.el7 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.6.10 for package: mysql-community-client-5.6.40-2.el7.x86_64
---> Package mysql-community-common.x86_64 0:5.6.40-2.el7 will be installed
--> Running transaction check
---> Package mysql-community-libs.x86_64 0:5.6.40-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================================================================
 Package                                              Arch                                 Version                                      Repository                                       Size
==============================================================================================================================================================================================
Installing:
 mysql-community-server                               x86_64                               5.6.40-2.el7                                 mysql56-community                                59 M
Installing for dependencies:
 mysql-community-client                               x86_64                               5.6.40-2.el7                                 mysql56-community                                19 M
 mysql-community-common                               x86_64                               5.6.40-2.el7                                 mysql56-community                               257 k
 mysql-community-libs                                 x86_64                               5.6.40-2.el7                                 mysql56-community                               2.0 M

Transaction Summary
==============================================================================================================================================================================================
Install  1 Package (+3 Dependent packages)

Total download size: 81 M
Installed size: 351 M
Is this ok [y/d/N]: y
Downloading packages:
(1/4): mysql-community-common-5.6.40-2.el7.x86_64.rpm                                                                                                                  | 257 kB  00:00:00
(2/4): mysql-community-libs-5.6.40-2.el7.x86_64.rpm                                                                                                                    | 2.0 MB  00:00:00
(3/4): mysql-community-client-5.6.40-2.el7.x86_64.rpm                                                                                                                  |  19 MB  00:00:04
(4/4): mysql-community-server-5.6.40-2.el7.x86_64.rpm                                                                                                                  |  59 MB  00:00:05

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                          12 MB/s |  81 MB  00:00:06
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : mysql-community-common-5.6.40-2.el7.x86_64                                                                                                                                 1/4
  Installing : mysql-community-libs-5.6.40-2.el7.x86_64                                                                                                                                   2/4
  Installing : mysql-community-client-5.6.40-2.el7.x86_64                                                                                                                                 3/4
  Installing : mysql-community-server-5.6.40-2.el7.x86_64                                                                                                                                 4/4

  Verifying  : mysql-community-client-5.6.40-2.el7.x86_64                                                                                                                                 1/4
  Verifying  : mysql-community-libs-5.6.40-2.el7.x86_64                                                                                                                                   2/4
  Verifying  : mysql-community-common-5.6.40-2.el7.x86_64                                                                                                                                 3/4
  Verifying  : mysql-community-server-5.6.40-2.el7.x86_64                                                                                                                                 4/4

Installed:
  mysql-community-server.x86_64 0:5.6.40-2.el7

Dependency Installed:
  mysql-community-client.x86_64 0:5.6.40-2.el7                   mysql-community-common.x86_64 0:5.6.40-2.el7                   mysql-community-libs.x86_64 0:5.6.40-2.el7

Complete!

[root@mysql-serv ~]# systemctl start mysqld
[root@mysql-serv ~]# systemctl status mysqld
● mysqld.service - MySQL Community Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; bad; vendor preset: disabled)
   Active: active (running) since Mon 2018-05-14 15:08:04 CST; 7s ago
  Process: 3847 ExecStartPost=/usr/bin/mysql-systemd-start post (code=exited, status=0/SUCCESS)
  Process: 3830 ExecStartPre=/usr/bin/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 3846 (mysqld_safe)
   CGroup: /system.slice/mysqld.service
           ├─3846 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
           └─4014 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --soc...

May 14 15:07:56 mysql-serv systemd[1]: Starting MySQL Community Server...
May 14 15:08:02 mysql-serv mysqld_safe[3846]: 180514 15:08:02 mysqld_safe Logging to '/var/log/mysqld.log'.
May 14 15:08:02 mysql-serv mysqld_safe[3846]: 180514 15:08:02 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
May 14 15:08:04 mysql-serv systemd[1]: Started MySQL Community Server.


[root@mysql-serv ~]# 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] n
 ... skipping.

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@mysql-serv ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.6.40 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, 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> select version();
+-----------+
| version() |
+-----------+
| 5.6.40    |
+-----------+
1 row in set (0.00 sec)



 


[Reference]
https://dev.mysql.com/doc/mysql-repo-excerpt/5.6/en/linux-installation-yum-repo.html

 

arrow
arrow
    全站熱搜

    DanBrother 發表在 痞客邦 留言(0) 人氣()