Jumat, 26 Oktober 2018

How to install mysql 5.5 community edition from official repo centos 6

  Tidak ada komentar
Download mysql repo package from mysql official website
[root@cloud ~]# wget https://dev.mysql.com/get/mysql80-community-release-el6-1.noarch.rpm
--2018-10-27 11:46:44--  https://dev.mysql.com/get/mysql80-community-release-el6-1.noarch.rpm
Connecting to 192.168.71.17:9898... connected.
Proxy request sent, awaiting response... 302 Found
Location: https://repo.mysql.com//mysql80-community-release-el6-1.noarch.rpm [following]
--2018-10-27 11:46:47--  https://repo.mysql.com//mysql80-community-release-el6-1.noarch.rpm
Connecting to 192.168.71.17:9898... connected.
Proxy request sent, awaiting response... 200 OK
Length: 25800 (25K) [application/x-redhat-package-manager]
Saving to: “mysql80-community-release-el6-1.noarch.rpm”

100%[============================================================================================>] 25,800      --.-K/s   in 0.003s

2018-10-27 11:46:49 (7.97 MB/s) - “mysql80-community-release-el6-1.noarch.rpm” saved [25800/25800]

[root@cloud ~]#
Check the mysql repo package and install it
[root@cloud ~]# ls
anaconda-ks.cfg                                    Sipencatar-cat-backup.2018-10-12_22-50-28.sql.gz
install.log                                        Sipencatar-cat-backup.2018-10-12_22-54-08.sql.gz
install.log.syslog                                 Sipencatar-cat-backup.2018-10-12_22-55-32.sql.gz
mysql80-community-release-el6-1.noarch.rpm         Sipencatar-portal-backup.2018-10-12_22-50-28.sql.gz
Sipencatar-cat2-backup.2018-10-12_22-50-28.sql.gz  Sipencatar-portal-backup.2018-10-12_22-54-08.sql.gz
Sipencatar-cat2-backup.2018-10-12_22-54-08.sql.gz  Sipencatar-portal-backup.2018-10-12_22-55-32.sql.gz
Sipencatar-cat2-backup.2018-10-12_22-55-32.sql.gz
[root@cloud ~]#
[root@cloud ~]# rpm -Uvh mysql80-community-release-el6-1.noarch.rpm
warning: mysql80-community-release-el6-1.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql80-community-relea########################################### [100%]
[root@cloud ~]#
Open mysql repo and disable mysql 8.0 version repo
[root@cloud ~]# cd /etc/yum.repos.d/
[root@cloud yum.repos.d]# ls
CentOS-Base.repo       CentOS-fasttrack.repo  CentOS-Vault.repo     mysql-community-source.repo
CentOS-Debuginfo.repo  CentOS-Media.repo      mysql-community.repo
[root@cloud yum.repos.d]#
[root@cloud yum.repos.d]# vi mysql-community.repo
[root@cloud yum.repos.d]#
Find the following text, and then change enable=1 to enable=0
[mysql80-community]
name=MySQL 8.0 Community Server
baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/6/$basearch/
enabled=0   (change from 1 to 0)
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Install mysql by enable specific version 
[root@cloud ~]# yum --enablerepo=mysql55-community install mysql-community-server
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: centos.biz.net.id
 * extras: centos.biz.net.id
 * updates: centos.biz.net.id
base                                                                                                           | 3.7 kB     00:00
extras                                                                                                         | 3.4 kB     00:00
extras/primary_db                                                                                              |  26 kB     00:00
mysql-connectors-community                                                                                     | 2.5 kB     00:00
mysql-connectors-community/primary_db                                                                          |  27 kB     00:00
mysql-tools-community                                                                                          | 2.5 kB     00:00
mysql-tools-community/primary_db                                                                               |  45 kB     00:00
mysql55-community                                                                                              | 2.5 kB     00:00
mysql55-community/primary_db                                                                                   | 225 kB     00:00
updates                                                                                                        | 3.4 kB     00:00
updates/primary_db                                                                                             | 1.9 MB     00:00
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.5.62-2.el6 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.5.62-2.el6 for package: mysql-community-server-5.5.62-2.el6.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 5.5.8 for package: mysql-community-server-5.5.62-2.el6.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.5.62-2.el6 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.5.8 for package: mysql-community-client-5.5.62-2.el6.x86_64
---> Package mysql-community-common.x86_64 0:5.5.62-2.el6 will be installed
--> Running transaction check
---> Package mysql-community-libs.x86_64 0:5.5.62-2.el6 will be obsoleting
---> Package mysql-libs.x86_64 0:5.1.73-8.el6_8 will be obsoleted
--> Processing Dependency: libmysqlclient.so.16()(64bit) for package: 2:postfix-2.6.6-8.el6.x86_64
--> Processing Dependency: libmysqlclient.so.16()(64bit) for package: perl-DBD-MySQL-4.013-3.el6.x86_64
--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: 2:postfix-2.6.6-8.el6.x86_64
--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: perl-DBD-MySQL-4.013-3.el6.x86_64
--> Running transaction check
---> Package mysql-community-libs-compat.x86_64 0:5.5.62-2.el6 will be obsoleting
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================
 Package                                    Arch                  Version                      Repository                        Size
======================================================================================================================================
Installing:
 mysql-community-libs                       x86_64                5.5.62-2.el6                 mysql55-community                1.7 M
     replacing  mysql-libs.x86_64 5.1.73-8.el6_8
 mysql-community-libs-compat                x86_64                5.5.62-2.el6                 mysql55-community                1.6 M
     replacing  mysql-libs.x86_64 5.1.73-8.el6_8
 mysql-community-server                     x86_64                5.5.62-2.el6                 mysql55-community                 38 M
Installing for dependencies:
 mysql-community-client                     x86_64                5.5.62-2.el6                 mysql55-community                 15 M
 mysql-community-common                     x86_64                5.5.62-2.el6                 mysql55-community                277 k

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

Total download size: 56 M
Is this ok [y/N]: y
Downloading Packages:
(1/5): mysql-community-client-5.5.62-2.el6.x86_64.rpm                                                          |  15 MB     00:00
(2/5): mysql-community-common-5.5.62-2.el6.x86_64.rpm                                                          | 277 kB     00:00
(3/5): mysql-community-libs-5.5.62-2.el6.x86_64.rpm                                                            | 1.7 MB     00:00
(4/5): mysql-community-libs-compat-5.5.62-2.el6.x86_64.rpm                                                     | 1.6 MB     00:01
(5/5): mysql-community-server-5.5.62-2.el6.x86_64.rpm                                                          |  38 MB     00:26
--------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                 1.6 MB/s |  56 MB     00:34
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 <[email protected]>
 Package: mysql80-community-release-el6-1.noarch (installed)
 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
Warning: RPMDB altered outside of yum.
  Installing : mysql-community-common-5.5.62-2.el6.x86_64                                                                         1/6
  Installing : mysql-community-libs-5.5.62-2.el6.x86_64                                                                           2/6
  Installing : mysql-community-client-5.5.62-2.el6.x86_64                                                                         3/6
  Installing : mysql-community-server-5.5.62-2.el6.x86_64                                                                         4/6
  Installing : mysql-community-libs-compat-5.5.62-2.el6.x86_64                                                                    5/6
  Erasing    : mysql-libs-5.1.73-8.el6_8.x86_64                                                                                   6/6
  Verifying  : mysql-community-libs-compat-5.5.62-2.el6.x86_64                                                                    1/6
  Verifying  : mysql-community-server-5.5.62-2.el6.x86_64                                                                         2/6
  Verifying  : mysql-community-client-5.5.62-2.el6.x86_64                                                                         3/6
  Verifying  : mysql-community-common-5.5.62-2.el6.x86_64                                                                         4/6
  Verifying  : mysql-community-libs-5.5.62-2.el6.x86_64                                                                           5/6
  Verifying  : mysql-libs-5.1.73-8.el6_8.x86_64                                                                                   6/6

Installed:
  mysql-community-libs.x86_64 0:5.5.62-2.el6                      mysql-community-libs-compat.x86_64 0:5.5.62-2.el6
  mysql-community-server.x86_64 0:5.5.62-2.el6

Dependency Installed:
  mysql-community-client.x86_64 0:5.5.62-2.el6                      mysql-community-common.x86_64 0:5.5.62-2.el6

Replaced:
  mysql-libs.x86_64 0:5.1.73-8.el6_8

Complete!
[root@cloud ~]#
Check mysql version
[root@cloud ~]# mysql -V
mysql  Ver 14.14 Distrib 5.5.62, for Linux (x86_64) using readline 5.1
[root@cloud ~]#
Start mysql service
[root@cloud ~]# service mysqld status
mysqld is stopped
[root@cloud ~]#
[root@cloud ~]# service mysqld start
Initializing MySQL database:  181027 12:02:40 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
181027 12:02:40 [Note] /usr/sbin/mysqld (mysqld 5.5.62) starting as process 92423 ...
181027 12:02:40 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
181027 12:02:40 [Note] /usr/sbin/mysqld (mysqld 5.5.62) starting as process 92430 ...

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h cloud password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

Please report any problems at http://bugs.mysql.com/

                                                           [  OK  ]
Starting mysqld:                                           [  OK  ]
[root@cloud ~]#
[root@cloud ~]# service mysqld status
mysqld (pid  92633) is running...
[root@cloud ~]#

Perform mysql secure installation
[root@cloud ~]# 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...
 ... Success!
 - 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!

Cleaning up...



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

Thanks for using MySQL!


[root@cloud ~]#
Restart mysql service and try mysql login to make sure there is no error
[root@cloud ~]#
[root@cloud ~]# service mysqld restart
Stopping mysqld:                                           [  OK  ]
Starting mysqld:                                           [  OK  ]
[root@cloud ~]#
[root@cloud ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.62 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>
mysql> exit
Bye
[root@cloud ~]#

Tidak ada komentar :

Posting Komentar