반응형

MYSQL 설치 (Oracle linux5 64bit + Mysql 5.7.13)

(참조 URL : http://dev.mysql.com/doc/refman/5.7/en/linux-installation-yum-repo.html)

 

1. Download mysql yum repository rpm file at http://dev.mysql.com/downloads/repo/yum/

   Oracle linux5 파일 mysql57-community-release-el5-7.noarch.rpm 다운로드 서버에  upload

 

2. Mysql yum Repository설치

[root@mysql ~]# rpm -Uvh mysql57-community-release-el5-7.noarch.rpm

warning: mysql57-community-release-el5-7.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 5072e1f5

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

   1:mysql57-community-relea########################################### [100%]

 

3. mysql repository 설치 확인 활성화 상태 확인

 

[root@mysql ~]# yum repolist all | grep mysql

This system is not registered with ULN.

You can use up2date --register to register.

ULN support will be disabled.

mysql-connectors-community        MySQL Connectors Community     enabled:      7

mysql-connectors-community-source MySQL Connectors Community - S disabled

mysql56-community                 MySQL 5.6 Community Server     disabled

mysql56-community-source          MySQL 5.6 Community Server - S disabled

mysql57-community                 MySQL 5.7 Community Server     enabled:     92

mysql57-community-source          MySQL 5.7 Community Server - S disabled

 

[root@mysql ~]# yum repolist enabled | grep mysql

This system is not registered with ULN.

You can use up2date --register to register.

ULN support will be disabled.

mysql-connectors-community MySQL Connectors Community                          7

mysql57-community          MySQL 5.7 Community Server                         92

 

위에 보면 5.7이 enable 되어 있으므로 그냥 설치 진행

 

4. 설치

[root@mysql ~]# yum install mysql-community-server

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

 Package                      Arch           Version           Repository              Size

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

Installing:

 mysql-community-server       x86_64        5.7.13-1.el5     mysql57-community        215 M

Installing for dependencies:

 mysql                        x86_64        5.7.13-1.el5     mysql57-community         40 k

 mysql-community-client       x86_64        5.7.13-1.el5     mysql57-community         31 M

 mysql-community-common       x86_64        5.7.13-1.el5     mysql57-community        810 k

 mysql-community-libs         x86_64        5.7.13-1.el5     mysql57-community        2.8 M

 mysql-community-libs-compat  x86_64        5.7.13-1.el5     mysql57-community        2.1 M

 

Transaction Summary

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

Install       6 Package(s)

Upgrade       0 Package(s)

 

Total download size: 252 M

Is this ok [y/N]: y

Downloading Packages:

(1/6): mysql-5.7.13-1.el5.x86_64.rpm                                       |  40 kB     00:00    

(2/6): mysql-community-common-5.7.13-1.el5.x86_64.rpm                      | 810 kB     00:00    

(3/6): mysql-community-libs-compat-5.7.13-1.el5.x86_64.rpm                 | 2.1 MB     00:00    

(4/6): mysql-community-libs-5.7.13-1.el5.x86_64.rpm                        | 2.8 MB     00:00    

(5/6): mysql-community-client-5.7.13-1.el5.x86_64.rpm                      |  31 MB     00:03    

(6/6): mysql-community-server-5.7.13-1.el5.x86_64.rpm                      | 215 MB     00:26    

----------------------------------------------------------------------------------------------------

Total                                                                                                                  8.0 MB/s | 252 MB     00:31    

warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 5072e1f5

mysql57-community/gpgkey   | 5.8 kB     00:00   

 

Importing GPG key 0x5072E1F5 "MySQL Release Engineering <mysql-build@oss.oracle.com>" from /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

Is this ok [y/N]: y

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing     : mysql-community-libs                        1/6

  Installing     : mysql-community-client                      2/6

  Installing     : mysql-community-common                      3/6

  Installing     : mysql-community-libs-compat                 4/6

  Installing     : mysql-community-server                      5/6

  Installing     : mysql                                       6/6


Installed:

  mysql-community-server.x86_64         0:5.7.131.el5  

Dependency Installed:

  mysql.x86_64 0:5.7.13-1.el5                    mysql-community-client.x86_64 0:5.7.13-1.el5          mysql-community-common.x86_64 0:5.7.13-1.el5   

  mysql-community-libs.x86_64 0:5.7.13-1.el5     mysql-community-libs-compat.x86_64 0:5.7.13-1.el5   

 

Complete!

 

완료 일줄 알았는데 패스워드를 몰라서 접속을 못하는 일이 발생 .

 

[root@mysql ~]# mysql

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

rpm으로 설치를 진행해서 특별히 암호를 입력하거나 하는 것이 없었는데 …

설치 시에 생성된 설치 로그 파일 /var/log/mysqld.log 열어보면  위쪽에서  temporary password 있음.

 

 /var/log/mysqld.log

2016-06-20T04:13:17.737419Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2016-06-20T04:13:17.978684Z 0 [Warning] InnoDB: New log files created, LSN=45790

2016-06-20T04:13:18.034498Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

2016-06-20T04:13:18.039389Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 5123053e-369d-11e6-9615-080027794699.

2016-06-20T04:13:18.039934Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.

2016-06-20T04:13:18.040715Z 1 [Note] A temporary password is generated for root@localhost: XP<RsUSp2NBI

2016-06-20T04:13:20.232361Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2016-06-20T04:13:20.233672Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.13) starting as process 29192 ...

2016-06-20T04:13:20.238472Z 0 [Note] InnoDB: PUNCH HOLE support not available

2016-06-20T04:13:20.238537Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2016-06-20T04:13:20.238554Z 0 [Note] InnoDB: Uses event mutexes

2016-06-20T04:13:20.238577Z 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier

2016-06-20T04:13:20.238588Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3

2016-06-20T04:13:20.238597Z 0 [Note] InnoDB: Using Linux native AIO

2016-06-20T04:13:20.238730Z 0 [Note] InnoDB: Number of pools: 1

 

비밀번호를 변경하기 위하여 safe 모드로 mysql 기동 root 패스워드 변경

 

터미널 #1 (safe 모드로 기동)

터미널 #2 (패스워드 변경)

[root@mysql log]# mysqld_safe --skip-grant-tables &

2016-06-21T01:13:50.436194Z mysqld_safe Logging to '/var/log/mysqld.log'.

2016-06-21T01:13:50.511188Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

 

 

[root@mysql ~]# mysql -u root

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

Your MySQL connection id is 2

Server version: 5.7.13-log MySQL Community Server (GPL)

 

Copyright (c) 2000, 2016, 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> update mysql.user set authentication_string=password('root1122') where user ='root' ;

Query OK, 1 row affected, 1 warning (0.00 sec)

Rows matched: 1  Changed: 1  Warnings: 1

 

mysql> flush privileges ;

Query OK, 0 rows affected (0.00 sec)

 

mysql> select 1 ;

+---+

| 1 |

+---+

| 1 |

+---+

1 row in set (0.00 sec)

 

mysql> exit

[root@mysql ~]# service mysqld stop

패스워드 정책을  LOW 변경

[root@mysql ~]# vi /etc/my.cnf

#Password policy

validate_password_policy=row   

[root@mysql ~]# service mysqld start

Starting mysqld:                             [  OK  ]

 

 

다시 로그인 하면 에러가

[root@mysql ~]# mysql -u root -p mysql

Enter password:

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

Your MySQL connection id is 3

Server version: 5.7.13-log

 

Copyright (c) 2000, 2016, 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 'root1122' ;

Query OK, 0 rows affected (0.01 sec)

 

mysql> flush privileges ;

Query OK, 0 rows affected (0.00 sec)

mysql> exit

Bye

 

 

[root@mysql ~]# mysql -u root -p mysql

Enter password:

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

 

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

Your MySQL connection id is 4

Server version: 5.7.13-log MySQL Community Server (GPL)

 

Copyright (c) 2000, 2016, 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

    -> ;

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

| Database           |

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

| information_schema |

| mysql              |

| performance_schema |

| sys                |

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

4 rows in set (0.00 sec)

 

에러 없이 정상 동작 .

 

 

리슨 포트 확인

 

mysql> show global variables like 'PORT' ;

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

| Variable_name | Value |

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

| port          | 3306  |

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

1 row in set (0.00 sec)


포트를 변경하고자 때는  /etc/my.cnf port=3307 이런 식으로 변경해 주면 .

반응형

+ Recent posts