Install MySQL 5.6 on CentOS 7

This will provide us the address of the rpm to auto-configure the MySQL Community Server repository.

$ sudo yum install http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
[sudo] password for training:
Loaded plugins: fastestmirror
mysql-community-release-el7-5.noarch.rpm                                                               | 6.0 kB  00:00:00    
Examining /var/tmp/yum-root-uI5SBL/mysql-community-release-el7-5.noarch.rpm: mysql-community-release-el7-5.noarch
Marking /var/tmp/yum-root-uI5SBL/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
Is this ok [y/d/N]: y
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!

We can check that the repository is effectively active by running:

$ sudo yum repolist enabled | grep "mysql.*-community.*"
[sudo] password for training:
mysql-connectors-community/x86_64       MySQL Connectors Community            9
mysql-tools-community/x86_64            MySQL Tools Community                 4
mysql56-community/x86_64                MySQL 5.6 Community Server           49

We have done a one-time configuration that will allow us to easily install and keep to date our MySQL installation.

The next step is actually installing the server packages. For that, we write:

$ sudo yum install mysql-community-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.mirror.xtratelecom.es
 * extras: centos.mirror.xtratelecom.es
 * updates: centos.mirror.xtratelecom.es
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.6.19-2.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.6.19-2.el7 for package: mysql-community-server-5.6.19-2.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) = 5.6.19-2.el7 for package: mysql-community-server-5.6.19-2.el7.x86_64
--> Processing Dependency: perl(warnings) for package: mysql-community-server-5.6.19-2.el7.x86_64
--> Processing Dependency: perl(strict) for package: mysql-community-server-5.6.19-2.el7.x86_64
$ sudo systemctl start mysqld
$ sudo systemctl status mysqld
mysqld.service - MySQL Community Server
  Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled)
  Active: active (running) since Sun 2014-07-27 11:20:40 EDT; 10s ago
 Process: 10660 ExecStartPost=/usr/bin/mysql-systemd-start post (code=exited, status=0/SUCCESS)
 Process: 10599 ExecStartPre=/usr/bin/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 10659 (mysqld_safe)
  CGroup: /system.slice/mysqld.service
          ├─10659 /bin/sh /usr/bin/mysqld_safe
          └─10801 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-erro...
 

And now connect from localhost by doing:

$ mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.19 MySQL Community Server (GPL)
 
Copyright (c) 2000, 2014, 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>

You may also like...

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *