Technical posts/MySQL

[Preparing DBMS Benchmark] Install MySQL 5.7.19 on CentOS 7.2

ODB 2017. 8. 4. 11:24

[Preparing DBMS Benchmark] Install MySQL 5.7.19 on CentOS 7.2


mysql 설치이다 바이너리로다가 경로깔끔하게 집어넣고 설치하려고 했으나.. 빨리빨리 하고 싶으니 후딱하자


https://dev.mysql.com/downloads/mysql/

에서 파일을 받고


번들로 그냥 통째로 받도록 하자


Step 1. tar 풀기


[root@localhost preinst]# ls

mysql-5.7.19-1.el7.x86_64.rpm-bundle.tar

[root@localhost preinst]# tar -xvf *

mysql-community-embedded-devel-5.7.19-1.el7.x86_64.rpm

mysql-community-client-5.7.19-1.el7.x86_64.rpm

mysql-community-server-5.7.19-1.el7.x86_64.rpm

mysql-community-test-5.7.19-1.el7.x86_64.rpm

mysql-community-embedded-compat-5.7.19-1.el7.x86_64.rpm

mysql-community-minimal-debuginfo-5.7.19-1.el7.x86_64.rpm

mysql-community-server-minimal-5.7.19-1.el7.x86_64.rpm

mysql-community-libs-compat-5.7.19-1.el7.x86_64.rpm

mysql-community-common-5.7.19-1.el7.x86_64.rpm

mysql-community-embedded-5.7.19-1.el7.x86_64.rpm

mysql-community-devel-5.7.19-1.el7.x86_64.rpm

mysql-community-libs-5.7.19-1.el7.x86_64.rpm 


Step 2. 기본설치된 library 제거


[root@localhost preinst]# yum remove mysql-libs-

Loaded plugins: fastestmirror

No Match for argument: mysql-libs-

No Packages marked for removal

[root@localhost preinst]# 


응?? 지울것이 없다고???

당황하지 않고 아래로 처리!


[root@localhost preinst]# yum remove mariadb-libs*

Loaded plugins: fastestmirror

Resolving Dependencies

--> Running transaction check

---> Package mariadb-libs.i686 1:5.5.52-1.el7 will be erased

---> Package mariadb-libs.x86_64 1:5.5.52-1.el7 will be erased

--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64

--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64

--> Running transaction check

---> Package postfix.x86_64 2:2.10.1-6.el7 will be erased

--> Finished Dependency Resolution


Dependencies Resolved


=====================================================================================================================================

 Package                                                    Arch                                                 Version                                                      Repository                                               Size

=====================================================================================================================================

Removing:

 mariadb-libs                                               i686                                                 1:5.5.52-1.el7                                               @base                                                   4.3 M

 mariadb-libs                                               x86_64                                               1:5.5.52-1.el7                                               @anaconda                                               4.4 M

Removing for dependencies:

 postfix                                                    x86_64                                               2:2.10.1-6.el7                                               @anaconda                                                12 M


Transaction Summary

=====================================================================================================================================

Remove  2 Packages (+1 Dependent package)


Installed size: 21 M

Is this ok [y/N]: y

Downloading packages:

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction


  Erasing    : 1:mariadb-libs-5.5.52-1.el7                                                                                                                                                                                              1/3 

  Erasing    : 2:postfix-2.10.1-6.el7.x86_64                                                                                                                                                                                            2/3 

  Erasing    : 1:mariadb-libs-5.5.52-1.el7                                                                                                                                                                                              3/3 

  Verifying  : 1:mariadb-libs-5.5.52-1.el7.i686                                                                                                                                                                                         1/3 

  Verifying  : 2:postfix-2.10.1-6.el7.x86_64                                                                                                                                                                                            2/3 

  Verifying  : 1:mariadb-libs-5.5.52-1.el7.x86_64                                                                                                                                                                                       3/3 


Removed:

  mariadb-libs.i686 1:5.5.52-1.el7                                                                                    mariadb-libs.x86_64 1:5.5.52-1.el7                                                                                   


Dependency Removed:

  postfix.x86_64 2:2.10.1-6.el7                                                                                                                                                                                                             


Complete! 



Step 3. yum install glibc libgcc libgcc* libstdc++ libstdc++* openssl openssl* libaio libaio* numactl numactl* ncurses-libs ncurses-libs* perl


[root@localhost preinst]# yum install glibc libgcc libgcc* libstdc++ libstdc++* openssl openssl* libaio libaio* numactl numactl* ncurses-libs ncurses-libs* perl

Loaded plugins: fastestmirror


base                                                                                                                                                                                                                 | 3.6 kB  00:00:00     


extras                                                                                                                                                                                                               | 3.4 kB  00:00:00     


updates                                                                                                                                                                                                              | 3.4 kB  00:00:00     

Loading mirror speeds from cached hostfile

 * base: mirror.xnet.co.nz

 * extras: mirror.xnet.co.nz

 * updates: mirror.xnet.co.nz

Package libgcc-4.8.5-11.el7.x86_64 already installed and latest version

Package libstdc++-4.8.5-11.el7.x86_64 already installed and latest version

Package libaio-0.3.109-13.el7.x86_64 already installed and latest version

...

Updated:

  glibc.x86_64 0:2.17-157.el7_3.5                                                                                     openssl.x86_64 1:1.0.1e-60.el7_3.1                                                                                    


Dependency Updated:

  glibc-common.x86_64 0:2.17-157.el7_3.5                                         krb5-libs.x86_64 0:1.14.1-27.el7_3                                         openssl-libs.x86_64 1:1.0.1e-60.el7_3.1                                        


Complete!

[root@localhost preinst]# ls


Step 4. 설치 ㄱㄱ


[root@localhost preinst]# rpm -Uvh mysql-community-common-5.7.*.el7.*.rpm

rpm -Uvh mysql-community-libs-5.7.*.el7.*.rpm

rpm -Uvh mysql-community-libs-compat-5.7.*.el7.*.rpm

rpm -Uvh mysql-community-devel-5.7.*.el7.*.rpm

rpm -Uvh mysql-community-embedded-5.7.*.el7.*.rpm

rpm -Uvh mysql-community-embedded-devel-5.7.*.el7.*.rpm

rpm -Uvh mysql-community-client-5.7.*.el7.*.rpm

rpm -Uvh mysql-community-server-5.7.*.el7.*.rpmwarning: mysql-community-common-5.7.19-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing...                          ################################# [100%]

Updating / installing...

   1:mysql-community-common-5.7.19-1.e################################# [100%]

[root@localhost preinst]# rpm -Uvh mysql-community-libs-5.7.*.el7.*.rpm

warning: mysql-community-libs-5.7.19-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing...                          ################################# [100%]

Updating / installing...

   1:mysql-community-libs-5.7.19-1.el7

################################# [100%]

[root@localhost preinst]# rpm -Uvh mysql-community-libs-compat-5.7.*.el7.*.rpm

warning: mysql-community-libs-compat-5.7.19-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing...                          ################################# [100%]

Updating / installing...

   1:mysql-community-libs-compat-5.7.1################################# [100%]

[root@localhost preinst]# rpm -Uvh mysql-community-devel-5.7.*.el7.*.rpm

warning: mysql-community-devel-5.7.19-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing...                          ################################# [100%]

Updating / installing...

   1:mysql-community-devel-5.7.19-1.el################################# [100%]

[root@localhost preinst]# rpm -Uvh mysql-community-embedded-5.7.*.el7.*.rpm

warning: mysql-community-embedded-5.7.19-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing...                          ################################# [100%]

Updating / installing...

   1:mysql-community-embedded-5.7.19-1################################# [100%]

[root@localhost preinst]# rpm -Uvh mysql-community-embedded-devel-5.7.*.el7.*.rpm

warning: mysql-community-embedded-devel-5.7.19-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing...                          ################################# [100%]

Updating / installing...

   1:mysql-community-embedded-devel-5.################################# [100%]

[root@localhost preinst]# rpm -Uvh mysql-community-client-5.7.*.el7.*.rpm

warning: mysql-community-client-5.7.19-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing...                          ################################# [100%]

Updating / installing...

   1:mysql-community-client-5.7.19-1.e################################# [100%]

[root@localhost preinst]# rpm -Uvh mysql-community-server-5.7.*.el7.*.rpm

warning: mysql-community-server-5.7.19-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing...                          ################################# [100%]

Updating / installing...

   1:mysql-community-server-5.7.19-1.e################################# [100%]




Step 5. 서비스시작 및 상태확인


[root@localhost preinst]# service mysqld start

Redirecting to /bin/systemctl start  mysqld.service

[root@localhost preinst]# ps -ef |grep mysql

mysql     2650     1 10 19:16 ?        00:00:00 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

root      2680  2266  0 19:16 pts/1    00:00:00 grep --color=auto mysql

[root@localhost preinst]# cd /var/log/

[root@localhost log]# cat mysqld.log |grep temporary

2017-08-03T23:16:24.366237Z 1 [Note] A temporary password is generated for root@localhost: :Q3b&A*<y%q=

2017-08-03T23:16:27.465656Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables

[root@localhost log]#

[root@localhost log]# mysql -uroot -p

Enter password: 

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 5

Server version: 5.7.19


Copyright (c) 2000, 2017, 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> show databases;

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.


mysql> alter user 'root'@'localhost' identified by '********';

Query OK, 0 rows affected (0.01 sec)


mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| sys                |

+--------------------+

4 rows in set (0.00 sec)


mysql>


Step 6. 유저만들고 권한주기


mysql> create user 'test'@'%' identified by 'Testtest1!';

Query OK, 0 rows affected (0.00 sec)


mysql> grant all privileges on *.* to 'test'@'%';

Query OK, 0 rows affected (0.00 sec)


mysql> select user,host from mysql.user;

+---------------+-----------+

| user          | host      |

+---------------+-----------+

| test          | %         |

| mysql.session | localhost |

| mysql.sys     | localhost |

| root          | localhost |

+---------------+-----------+

4 rows in set (0.00 sec)


mysql> 


Mysql도 끝!

"이 포스팅은 쿠팡 파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다."