How to install MYSQL on Centos


Step 1: download RMP file, for Centos 6.x 64bits, you can use file: http://repo.mysql.com/yum/mysql-5.7-community/el/6/x86_64/mysql57-community-release-el6-7.noarch.rpm

Depend on version of CentOS, you can find your file at here

wget http://repo.mysql.com/yum/mysql-5.7-community/el/6/x86_64/mysql57-community-release-el6-7.noarch.rpm

install mysql on centos 1

Result:

[root@tutorialspots ~]# wget http://repo.mysql.com/yum/mysql-5.7-community/e
l/6/x86_64/mysql57-community-release-el6-7.noarch.rpm
--2016-11-06 15:59:00--  http://repo.mysql.com/yum/mysql-5.7-community/el/6/x86_
64/mysql57-community-release-el6-7.noarch.rpm
Resolving repo.mysql.com... 23.219.134.205
Connecting to repo.mysql.com|23.219.134.205|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8848 (8.6K) [application/x-redhat-package-manager]
Saving to: `mysql57-community-release-el6-7.noarch.rpm'

100%[======================================>] 8,848       --.-K/s   in 0s

2016-11-06 15:59:00 (407 MB/s) - `mysql57-community-release-el6-7.noarch.rpm' sa
ved [8848/8848]

Step 2:

yum localinstall mysql57-community-release-el6-7.noarch.rpm

result:

[root@tutorialspots ~]# yum localinstall mysql57-community-release-el6-7.noa
rch.rpm
Loaded plugins: fastestmirror
Setting up Local Package Process
Examining mysql57-community-release-el6-7.noarch.rpm: mysql57-community-release-
el6-7.noarch
Marking mysql57-community-release-el6-7.noarch.rpm to be installed
Determining fastest mirrors
 * base: mirrors.vonline.vn
 * extras: mirrors.vonline.vn
 * updates: mirrors.vonline.vn
base                                                     | 3.7 kB     00:00
base/primary_db                                          | 4.7 MB     00:00
extras                                                   | 3.4 kB     00:00
extras/primary_db                                        |  37 kB     00:00
updates                                                  | 3.4 kB     00:00
updates/primary_db                                       | 3.1 MB     00:00
Resolving Dependencies
--> Running transaction check
---> Package mysql57-community-release.noarch 0:el6-7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package             Arch   Version
                                  Repository                               Size
================================================================================
Installing:
 mysql57-community-release
                     noarch el6-7 /mysql57-community-release-el6-7.noarch 7.8 k

Transaction Summary
================================================================================
Install       1 Package(s)

Total size: 7.8 k
Installed size: 7.8 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : mysql57-community-release-el6-7.noarch                       1/1
  Verifying  : mysql57-community-release-el6-7.noarch                       1/1

Installed:
  mysql57-community-release.noarch 0:el6-7

Complete!

Step 3:

yum install mysql-community-server

Result:

[root@tutorialspots ~]# yum install mysql-community-server
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: mirrors.vonline.vn
 * extras: mirrors.vonline.vn
 * updates: mirrors.vonline.vn
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.7.16-1.el6 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.7.16-1.el6 for pac
kage: mysql-community-server-5.7.16-1.el6.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package:
mysql-community-server-5.7.16-1.el6.x86_64
--> Processing Dependency: perl(strict) for package: mysql-community-server-5.7.
16-1.el6.x86_64
--> Processing Dependency: perl(POSIX) for package: mysql-community-server-5.7.1
6-1.el6.x86_64
--> Processing Dependency: perl(Getopt::Long) for package: mysql-community-serve
r-5.7.16-1.el6.x86_64
--> Processing Dependency: perl(File::Path) for package: mysql-community-server-
5.7.16-1.el6.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.4)(64bit) for package: mysql-com
munity-server-5.7.16-1.el6.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.1)(64bit) for package: mysql-com
munity-server-5.7.16-1.el6.x86_64
--> Processing Dependency: /usr/bin/perl for package: mysql-community-server-5.7
.16-1.el6.x86_64
--> Processing Dependency: libnuma.so.1()(64bit) for package: mysql-community-se
rver-5.7.16-1.el6.x86_64
--> Processing Dependency: libaio.so.1()(64bit) for package: mysql-community-ser
ver-5.7.16-1.el6.x86_64
--> Running transaction check
---> Package libaio.x86_64 0:0.3.107-10.el6 will be installed
---> Package mysql-community-client.x86_64 0:5.7.16-1.el6 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: my
sql-community-client-5.7.16-1.el6.x86_64
---> Package mysql-community-common.x86_64 0:5.7.16-1.el6 will be installed
---> Package numactl.x86_64 0:2.0.9-2.el6 will be installed
---> Package perl.x86_64 4:5.10.1-141.el6_7.1 will be installed
--> Processing Dependency: perl-libs = 4:5.10.1-141.el6_7.1 for package: 4:perl-
5.10.1-141.el6_7.1.x86_64
--> Processing Dependency: perl-libs for package: 4:perl-5.10.1-141.el6_7.1.x86_
64
--> Processing Dependency: perl(version) for package: 4:perl-5.10.1-141.el6_7.1.
x86_64
--> Processing Dependency: perl(Pod::Simple) for package: 4:perl-5.10.1-141.el6_
7.1.x86_64
--> Processing Dependency: perl(Module::Pluggable) for package: 4:perl-5.10.1-14
1.el6_7.1.x86_64
--> Processing Dependency: libperl.so()(64bit) for package: 4:perl-5.10.1-141.el
6_7.1.x86_64
--> Running transaction check
---> Package mysql-community-libs.x86_64 0:5.7.16-1.el6 will be obsoleting
---> Package mysql-libs.x86_64 0:5.1.73-3.el6_5 will be obsoleted
--> Processing Dependency: libmysqlclient.so.16()(64bit) for package: 2:postfix-
2.6.6-6.el6_5.x86_64
--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for pa
ckage: 2:postfix-2.6.6-6.el6_5.x86_64
---> Package perl-Module-Pluggable.x86_64 1:3.90-141.el6_7.1 will be installed
---> Package perl-Pod-Simple.x86_64 1:3.13-141.el6_7.1 will be installed
--> Processing Dependency: perl(Pod::Escapes) >= 1.04 for package: 1:perl-Pod-Si
mple-3.13-141.el6_7.1.x86_64
---> Package perl-libs.x86_64 4:5.10.1-141.el6_7.1 will be installed
---> Package perl-version.x86_64 3:0.77-141.el6_7.1 will be installed
--> Running transaction check
---> Package mysql-community-libs-compat.x86_64 0:5.7.16-1.el6 will be obsoletin
g
---> Package perl-Pod-Escapes.x86_64 1:1.04-141.el6_7.1 will be installed
---> Package postfix.x86_64 2:2.6.6-6.el6_5 will be updated
---> Package postfix.x86_64 2:2.6.6-6.el6_7.1 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                    Arch   Version              Repository         Size
================================================================================
Installing:
 mysql-community-libs       x86_64 5.7.16-1.el6         mysql57-community 2.1 M
     replacing  mysql-libs.x86_64 5.1.73-3.el6_5
 mysql-community-libs-compat
                            x86_64 5.7.16-1.el6         mysql57-community 1.6 M
     replacing  mysql-libs.x86_64 5.1.73-3.el6_5
 mysql-community-server     x86_64 5.7.16-1.el6         mysql57-community 144 M
Installing for dependencies:
 libaio                     x86_64 0.3.107-10.el6       base               21 k
 mysql-community-client     x86_64 5.7.16-1.el6         mysql57-community  23 M
 mysql-community-common     x86_64 5.7.16-1.el6         mysql57-community 327 k
 numactl                    x86_64 2.0.9-2.el6          base               74 k
 perl                       x86_64 4:5.10.1-141.el6_7.1 base               10 M
 perl-Module-Pluggable      x86_64 1:3.90-141.el6_7.1   base               40 k
 perl-Pod-Escapes           x86_64 1:1.04-141.el6_7.1   base               33 k
 perl-Pod-Simple            x86_64 1:3.13-141.el6_7.1   base              213 k
 perl-libs                  x86_64 4:5.10.1-141.el6_7.1 base              579 k
 perl-version               x86_64 3:0.77-141.el6_7.1   base               52 k
Updating for dependencies:
 postfix                    x86_64 2:2.6.6-6.el6_7.1    base              2.0 M

Transaction Summary
================================================================================
Install      13 Package(s)
Upgrade       1 Package(s)

Total download size: 184 M
Is this ok [y/N]: y
Downloading Packages:
(1/14): libaio-0.3.107-10.el6.x86_64.rpm                 |  21 kB     00:00
(2/14): mysql-community-client-5.7.16-1.el6.x86_64.rpm   |  23 MB     00:10
(3/14): mysql-community-common-5.7.16-1.el6.x86_64.rpm   | 327 kB     00:00
(4/14): mysql-community-libs-5.7.16-1.el6.x86_64.rpm     | 2.1 MB     00:01
(5/14): mysql-community-libs-compat-5.7.16-1.el6.x86_64. | 1.6 MB     00:00
(6/14): mysql-community-server-5.7.16-1.el6.x86_64.rpm   | 144 MB     01:27
(7/14): numactl-2.0.9-2.el6.x86_64.rpm                   |  74 kB     00:00
(8/14): perl-5.10.1-141.el6_7.1.x86_64.rpm               |  10 MB     00:00
(9/14): perl-Module-Pluggable-3.90-141.el6_7.1.x86_64.rp |  40 kB     00:00
(10/14): perl-Pod-Escapes-1.04-141.el6_7.1.x86_64.rpm    |  33 kB     00:00
(11/14): perl-Pod-Simple-3.13-141.el6_7.1.x86_64.rpm     | 213 kB     00:00
(12/14): perl-libs-5.10.1-141.el6_7.1.x86_64.rpm         | 579 kB     00:00
(13/14): perl-version-0.77-141.el6_7.1.x86_64.rpm        |  52 kB     00:00
(14/14): postfix-2.6.6-6.el6_7.1.x86_64.rpm              | 2.0 MB     00:00
--------------------------------------------------------------------------------
Total                                           1.8 MB/s | 184 MB     01:42
warning: rpmts_HdrFromFdno: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
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>
 Package: mysql57-community-release-el6-7.noarch (@/mysql57-community-release-el
6-7.noarch)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : mysql-community-common-5.7.16-1.el6.x86_64                  1/16
  Installing : mysql-community-libs-5.7.16-1.el6.x86_64                    2/16
  Installing : mysql-community-libs-compat-5.7.16-1.el6.x86_64             3/16
  Installing : mysql-community-client-5.7.16-1.el6.x86_64                  4/16
  Installing : 1:perl-Pod-Escapes-1.04-141.el6_7.1.x86_64                  5/16
  Installing : 1:perl-Module-Pluggable-3.90-141.el6_7.1.x86_64             6/16
  Installing : 3:perl-version-0.77-141.el6_7.1.x86_64                      7/16
  Installing : 4:perl-libs-5.10.1-141.el6_7.1.x86_64                       8/16
  Installing : 1:perl-Pod-Simple-3.13-141.el6_7.1.x86_64                   9/16
  Installing : 4:perl-5.10.1-141.el6_7.1.x86_64                           10/16
  Installing : libaio-0.3.107-10.el6.x86_64                               11/16
  Installing : numactl-2.0.9-2.el6.x86_64                                 12/16
  Installing : mysql-community-server-5.7.16-1.el6.x86_64                 13/16
  Updating   : 2:postfix-2.6.6-6.el6_7.1.x86_64                           14/16
  Cleanup    : 2:postfix-2.6.6-6.el6_5.x86_64                             15/16
  Erasing    : mysql-libs-5.1.73-3.el6_5.x86_64                           16/16
  Verifying  : mysql-community-libs-compat-5.7.16-1.el6.x86_64             1/16
  Verifying  : mysql-community-common-5.7.16-1.el6.x86_64                  2/16
  Verifying  : 1:perl-Pod-Escapes-1.04-141.el6_7.1.x86_64                  3/16
  Verifying  : mysql-community-server-5.7.16-1.el6.x86_64                  4/16
  Verifying  : numactl-2.0.9-2.el6.x86_64                                  5/16
  Verifying  : 2:postfix-2.6.6-6.el6_7.1.x86_64                            6/16
  Verifying  : 1:perl-Module-Pluggable-3.90-141.el6_7.1.x86_64             7/16
  Verifying  : 1:perl-Pod-Simple-3.13-141.el6_7.1.x86_64                   8/16
  Verifying  : 3:perl-version-0.77-141.el6_7.1.x86_64                      9/16
  Verifying  : mysql-community-client-5.7.16-1.el6.x86_64                 10/16
  Verifying  : mysql-community-libs-5.7.16-1.el6.x86_64                   11/16
  Verifying  : libaio-0.3.107-10.el6.x86_64                               12/16
  Verifying  : 4:perl-libs-5.10.1-141.el6_7.1.x86_64                      13/16
  Verifying  : 4:perl-5.10.1-141.el6_7.1.x86_64                           14/16
  Verifying  : mysql-libs-5.1.73-3.el6_5.x86_64                           15/16
  Verifying  : 2:postfix-2.6.6-6.el6_5.x86_64                             16/16

Installed:
  mysql-community-libs.x86_64 0:5.7.16-1.el6
  mysql-community-libs-compat.x86_64 0:5.7.16-1.el6
  mysql-community-server.x86_64 0:5.7.16-1.el6

Dependency Installed:
  libaio.x86_64 0:0.3.107-10.el6
  mysql-community-client.x86_64 0:5.7.16-1.el6
  mysql-community-common.x86_64 0:5.7.16-1.el6
  numactl.x86_64 0:2.0.9-2.el6
  perl.x86_64 4:5.10.1-141.el6_7.1
  perl-Module-Pluggable.x86_64 1:3.90-141.el6_7.1
  perl-Pod-Escapes.x86_64 1:1.04-141.el6_7.1
  perl-Pod-Simple.x86_64 1:3.13-141.el6_7.1
  perl-libs.x86_64 4:5.10.1-141.el6_7.1
  perl-version.x86_64 3:0.77-141.el6_7.1

Dependency Updated:
  postfix.x86_64 2:2.6.6-6.el6_7.1

Replaced:
  mysql-libs.x86_64 0:5.1.73-3.el6_5

Complete!

Step 4:

service mysqld start

Result:

[root@tutorialspots ~]# service mysqld start
Initializing MySQL database:                               [  OK  ]
Installing validate password plugin:                       [  OK  ]
Starting mysqld:                                           [  OK  ]

Done!

Now you can check Mysql status:

service mysqld status

Result:

[root@tutorialspots ~]# service mysqld status
mysqld (pid  3042) is running...

How to know the default root password of MYSQL 5.7

How to change Mysql root password

Leave a Reply