티스토리 뷰

IA/DB

[mysql] centos 7 에서 mysql 설치

kiostory 2019. 2. 28. 23:02

설치여부 확인

[root@ncloud-server-centos1 lib64]# rpm -qa |grep ^mysql
[root@ncloud-server-centos1 lib64]#


yum으로 설치될까?

[root@ncloud-server-centos1 lib64]# yum install *mysql-server*
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * epel: mirror.premi.st
base/7/x86_64/filelists_db                                                                                      | 7.1 MB  00:03:45
epel/x86_64/filelists_db                                                                                        |  11 MB  00:00:01
extras/7/x86_64/filelists_db                                                                                    | 231 kB  00:00:00
updates/7/x86_64/filelists_db                                                                                   | 1.9 MB  00:00:00
No package *mysql-server* available.
Error: Nothing to do


안된다. 다시.


[root@ncloud-server-centos1 lib64]# yum install mysql-community-server
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * epel: mirror.premi.st
No package mysql-community-server available.
Error: Nothing to do


안된다.

홈페이지에서 rpm 다운로드하자


[root@ncloud-server-centos1 lib64]# wget http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm


cf. wget

NAME
       Wget - The non-interactive network downloader.

SYNOPSIS
       wget [option]... [URL]...

설치되어있지 않다면, yum install wget

--2019-02-28 21:40:15--  http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
Resolving dev.mysql.com (dev.mysql.com)... 137.254.60.11
Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm [following]
--2019-02-28 21:40:16--  https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm [following]
--2019-02-28 21:40:16--  https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm
Resolving repo.mysql.com (repo.mysql.com)... 23.212.13.170
Connecting to repo.mysql.com (repo.mysql.com)|23.212.13.170|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 25680 (25K) [application/x-redhat-package-manager]
Saving to: ‘mysql57-community-release-el7-11.noarch.rpm’

100%[=============================================================================================>] 25,680      --.-K/s   in 0s

2019-02-28 21:40:17 (365 MB/s) - ‘mysql57-community-release-el7-11.noarch.rpm’ saved [25680/25680]


[root@ncloud-server-centos1 tmp]# yum install mysql57-community-release-el7-11.noarch.rpm
Loaded plugins: fastestmirror, langpacks
Examining mysql57-community-release-el7-11.noarch.rpm: mysql57-community-release-el7-11.noarch
Marking mysql57-community-release-el7-11.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package mysql57-community-release.noarch 0:el7-11 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================================================
 Package                              Arch              Version              Repository                                           Size
=======================================================================================================================================
Installing:
 mysql57-community-release            noarch            el7-11               /mysql57-community-release-el7-11.noarch             31 k

Transaction Summary
=======================================================================================================================================
Install  1 Package

Total size: 31 k
Installed size: 31 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : mysql57-community-release-el7-11.noarch                                                                             1/1
  Verifying  : mysql57-community-release-el7-11.noarch                                                                             1/1

Installed:
  mysql57-community-release.noarch 0:el7-11

Complete!



[root@ncloud-server-centos1 tmp]# yum install mysql-community-server
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * epel: mirror.premi.st
mysql-connectors-community                                                                                      | 2.5 kB  00:00:00
mysql-tools-community                                                                                           | 2.5 kB  00:00:00
mysql57-community                                                                                               | 2.5 kB  00:00:00
(1/3): mysql-tools-community/x86_64/primary_db                                                                  |  54 kB  00:00:00
(2/3): mysql57-community/x86_64/primary_db                                                                      | 170 kB  00:00:00
(3/3): mysql-connectors-community/x86_64/primary_db                                                             |  37 kB  00:00:00
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.7.25-1.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.7.25-1.el7 for package: mysql-community-server-5.7.25-1.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.25-1.el7.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.7.25-1.el7 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.25-1.el7.x86_64
---> Package mysql-community-common.x86_64 0:5.7.25-1.el7 will be installed
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.60-1.el7_5 will be obsoleted
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-7.el7.x86_64
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-7.el7.x86_64
---> Package mysql-community-libs.x86_64 0:5.7.25-1.el7 will be obsoleting
--> Running transaction check
---> Package mysql-community-libs-compat.x86_64 0:5.7.25-1.el7 will be obsoleting
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================================================
 Package                                    Arch                  Version                       Repository                        Size
=======================================================================================================================================
Installing:
 mysql-community-libs                       x86_64                5.7.25-1.el7                  mysql57-community                2.2 M
     replacing  mariadb-libs.x86_64 1:5.5.60-1.el7_5
 mysql-community-libs-compat                x86_64                5.7.25-1.el7                  mysql57-community                2.0 M
     replacing  mariadb-libs.x86_64 1:5.5.60-1.el7_5
 mysql-community-server                     x86_64                5.7.25-1.el7                  mysql57-community                165 M
Installing for dependencies:
 mysql-community-client                     x86_64                5.7.25-1.el7                  mysql57-community                 24 M
 mysql-community-common                     x86_64                5.7.25-1.el7                  mysql57-community                274 k

Transaction Summary
=======================================================================================================================================
Install  3 Packages (+2 Dependent packages)

Total download size: 194 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/mysql57-community/packages/mysql-community-common-5.7.25-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Public key for mysql-community-common-5.7.25-1.el7.x86_64.rpm is not installed
(1/5): mysql-community-common-5.7.25-1.el7.x86_64.rpm                                                           | 274 kB  00:00:00
(2/5): mysql-community-libs-5.7.25-1.el7.x86_64.rpm                                                             | 2.2 MB  00:00:00
(3/5): mysql-community-libs-compat-5.7.25-1.el7.x86_64.rpm                                                      | 2.0 MB  00:00:00
(4/5): mysql-community-client-5.7.25-1.el7.x86_64.rpm                                                           |  24 MB  00:00:00
(5/5): mysql-community-server-5.7.25-1.el7.x86_64.rpm                                                           | 165 MB  00:00:35
---------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                  5.0 MB/s | 194 MB  00:00:38
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>"
 Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
 Package    : mysql57-community-release-el7-11.noarch (installed)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : mysql-community-common-5.7.25-1.el7.x86_64                                                                          1/6
  Installing : mysql-community-libs-5.7.25-1.el7.x86_64                                                                            2/6
  Installing : mysql-community-client-5.7.25-1.el7.x86_64                                                                          3/6
  Installing : mysql-community-server-5.7.25-1.el7.x86_64                                                                          4/6
  Installing : mysql-community-libs-compat-5.7.25-1.el7.x86_64                                                                     5/6
  Erasing    : 1:mariadb-libs-5.5.60-1.el7_5.x86_64                                                                                6/6
  Verifying  : mysql-community-libs-5.7.25-1.el7.x86_64                                                                            1/6
  Verifying  : mysql-community-common-5.7.25-1.el7.x86_64                                                                          2/6
  Verifying  : mysql-community-server-5.7.25-1.el7.x86_64                                                                          3/6
  Verifying  : mysql-community-client-5.7.25-1.el7.x86_64                                                                          4/6
  Verifying  : mysql-community-libs-compat-5.7.25-1.el7.x86_64                                                                     5/6
  Verifying  : 1:mariadb-libs-5.5.60-1.el7_5.x86_64                                                                                6/6

Installed:
  mysql-community-libs.x86_64 0:5.7.25-1.el7                      mysql-community-libs-compat.x86_64 0:5.7.25-1.el7
  mysql-community-server.x86_64 0:5.7.25-1.el7

Dependency Installed:
  mysql-community-client.x86_64 0:5.7.25-1.el7                       mysql-community-common.x86_64 0:5.7.25-1.el7

Replaced:
  mariadb-libs.x86_64 1:5.5.60-1.el7_5

Complete!


오예~


[root@ncloud-server-centos1 tmp]# systemctl start mysqld

[root@ncloud-server-centos1 tmp]#
[root@ncloud-server-centos1 tmp]# ps -ef |grep mysql
mysql     6781     1  0 21:50 ?        00:00:00 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
root      6885  3841  0 21:51 pts/0    00:00:00 grep --color=auto mysql


[root@ncloud-server-centos1 tmp]# service mysqld status
Redirecting to /bin/systemctl status mysqld.service
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2019-02-28 21:50:28 KST; 2min 37s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 6777 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 6593 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 6781 (mysqld)
   CGroup: /system.slice/mysqld.service
           └─6781 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

Feb 28 21:49:05 ncloud-server-centos1 systemd[1]: Starting MySQL Server...
Feb 28 21:50:28 ncloud-server-centos1 systemd[1]: Started MySQL Server.


아싸


[root@ncloud-server-centos1 tmp]# mysql -u root -p
Enter password:  설치중에 물어보지도 않고서는 나에게 어이없이 묻고있다 -_-
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

설치중 로그를 확인

 

[root@ncloud-server-centos1 tmp]# grep password /var/log/mysqld.log
2019-02-28T12:50:08.570898Z 1 [Note] A temporary password is generated for root@localhost: KrKe_gqLe6g!
2019-02-28T12:51:07.651954Z 2 [Note] Access denied for user 'root'@'localhost' (using password: NO)
2019-02-28T12:51:32.036163Z 3 [Note] Access denied for user 'root'@'localhost' (using password: YES)
2019-02-28T12:51:54.745807Z 4 [Note] Access denied for user 'root'@'localhost' (using password: YES)


다시 로그인 시도


[root@ncloud-server-centos1 tmp]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.25

Copyright (c) 2000, 2019, 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 identied by '사용할패스워드';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'identied by 'xxxxxxxx' at line 1


실패


mysql> alter user root@localhost identied by '사용할패스워드';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'identied by 'xxxxxxxx' at line 1


또 실패

googling.....

https://dev.mysql.com/doc/refman/5.6/en/alter-user.html


mysql> set password=password('사용할패스워드');
Query OK, 0 rows affected, 1 warning (0.00 sec)


초기 패스워드 변경 성공!

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)


:)


'IA > DB' 카테고리의 다른 글

[mysql] 실습 schema 및 object 생성  (0) 2019.03.01
[mysql] 초기 설치 후 샘플 데이터베이스 설치  (0) 2019.02.28
[mysql] join  (0) 2019.02.27
[mysql] table column 명 변경  (0) 2019.02.26
[mysql] delete  (0) 2019.02.26
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
글 보관함