λ³Έλ¬Έ λ°”λ‘œκ°€κΈ°
μ†Œμ†Œν•œ 지식/Install & Settings

[Linux] MySQL 5.7 μ„€μΉ˜

by μš”νƒ„λ λˆ„λ‚˜ 2019. 7. 8.

μ•ˆλ…•ν•˜μ„Έμš”, μš”νƒ„λ λˆ„λ‚˜μž…λ‹ˆλ‹€ :)

λ„ˆλ¬΄ μ˜€λžœλ§Œμ— 글을 μ“°κ²Œ λ˜μ—ˆμŠ΅λ‹ˆλ‹€γ… γ… 

 

정신없이 μ§€λ‚˜κ°€λ‹€λ³΄λ‹ˆ μ–΄λŠμƒˆ 7월이 λ‹€κ°€μ™”μ–΄μš”!

ν˜„μ‹€μ€ μ˜€λŠ˜λ„ 어김없이 μžνŒμ„ λ‘λ“€κΈ°μ§€λ§Œ~~~

 

CentOSμ—μ„œμ˜ MySQL5.7 μ„€μΉ˜μ— λŒ€ν•΄μ„œ μ•Œμ•„λ³΄λ„λ‘ ν•˜κ² μŠ΅λ‹ˆλ‹€!

ꡉμž₯히 κ°„λ‹¨ν•˜μ§€λ§Œ yum install을 ν–ˆλŠ”λ°λ„, mysql 접속이 μ•ˆλ˜μ…¨λ˜ 적이 μžˆμœΌμ…¨μ„ 것 같은데!

κ·ΈλŸ¬μ‹  뢄듀은 λ‹€μŒκ³Ό 같이 μ§„ν–‰ν•˜μ‹œλ©΄ μ›ν™œν•˜κ²Œ μ ‘μ†λ˜μ‹€ κ±°μ˜ˆμš”!

 

 

00. ν˜„ Serverμ—μ„œ yum μ—…λ°μ΄νŠΈ μ§„ν–‰ν•˜κ³ , μΆ”κ°€λ‘œ wget이 μ„€μΉ˜κ°€ μ•ˆλ˜μ–΄μžˆλ‹€λ©΄ 같이 μ„€μΉ˜ μ§„ν–‰ν•΄μ£Όμ„Έμš”.

 

[root@localhost /]# yum update
[root@localhost /]# yum install wget

 

 

01. wget을 μ΄μš©ν•΄μ„œ mysql install rpm 파일 λ‹€μš΄λ‘œλ“œ

 

[root@localhost mysql]# wget http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
[root@localhost mysql]# ll
	total 28
	-rw-r--r--. 1 root root 25680 Apr 27  2017 mysql57-community-release-el7-11.noarch.rpm

 

 

02. rpm νŒŒμΌμ„ yum을 μ΄μš©ν•΄μ„œ μ„€μΉ˜ μ§„ν–‰

 

[root@localhost mysql]# yum install mysql57-community-release-el7-11.noarch.rpm

 

 

03. mysql에 yum repository ν™œμ„±ν™”

 

[root@localhost mysql]# yum repolist enabled | grep "mysql.*-community.*"
	mysql-connectors-community/x86_64       MySQL Connectors Community           108
	mysql-tools-community/x86_64            MySQL Tools Community                 90
	mysql57-community/x86_64                MySQL 5.7 Community Server           347

 

 

04. mysql install 

 

[root@localhost mysql]# yum install mysql-community-server mysql mysql-libs mysql-devel mysql-server

 

 

05. mysql service μ‹€ν–‰ 

 

[root@localhost mysql]# systemctl start mysqld
[root@localhost mysql]# systemctl status mysqld
	● mysqld.service - MySQL Server
   	Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   	Active: active (running) since Sun 2019-07-07 19:45:17 PDT; 7s ago
    	 Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  	Process: 105689 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  	Process: 105606 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 	Main PID: 105691 (mysqld)
    	Tasks: 27
   	CGroup: /system.slice/mysqld.service
     	      └─105691 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

	Jul 07 19:45:12 localhost.localdomain systemd[1]: Starting MySQL Server...	
	Jul 07 19:45:17 localhost.localdomain systemd[1]: Started MySQL Server.

 

 

06. mysql serviceλ₯Ό μžλ™ 싀행될 수 μžˆλ„λ‘ μ„€μ •

 

[root@localhost mysql]# systemctl enable mysqld

 

 

07. mysql 접속

 

(tip:) mysql 접속 root 초기 μ„€μ • λΉ„λ°€λ²ˆν˜ΈλŠ” /var/log/mysqld.logμ—μ„œ 확인할 수 μžˆμŠ΅λ‹ˆλ‹€. μ•„λž˜ μΊ‘μ²˜λ³Έμ— temporary password에 λ‚˜μ™€ μžˆλŠ” password둜 접속이 λ©λ‹ˆλ‹€!

 

 

 

[root@localhost mysql]# mysql -uroot -p
	Enter password: 
	Welcome to the MySQL monitor.  Commands end with ; or \g.
	Your MySQL connection id is 3
	Server version: 5.7.26

	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.

 

초기 λΉ„λ°€λ²ˆν˜Έλ‘œ 접속은 κ°€λŠ₯ν•˜μ§€λ§Œ, λ°”λ‘œ ERRORκ°€ λœ¨λŠ” κ±Έ 보싀 수 μžˆμ–΄μš”!

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

λ°”λ‘œ root의 초기 λΉ„λ°€λ²ˆν˜Έλ₯Ό 변경해주도둝 ν• κ²Œμš”.

 

mysql> SET PASSWORD = PASSWORD('new_password');
	Query OK, 0 rows affected, 1 warning (0.00 sec)

 

 

 

08. MySQL μ„€μΉ˜ 및 접속 μ™„λ£Œ 

 

[root@localhost mysql]# mysql -uroot -p
	Enter password: 
	Welcome to the MySQL monitor.  Commands end with ; or \g.
	Your MySQL connection id is 4
	Server version: 5.7.26 MySQL Community Server (GPL)

	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;
	+--------------------+
	| Database           |
	+--------------------+
	| information_schema |
	| mysql              |
	| performance_schema |
	| sys                |
	+--------------------+
	4 rows in set (0.01 sec)

 

μ΄λ ‡κ²Œ MySQL μ„€μΉ˜μ™€ 접속이 λͺ¨λ‘ μ™„λ£Œλ˜μ—ˆμŠ΅λ‹ˆλ‹€!

μœ μš©ν•œ 정보가 λ˜μ…¨κΈ°λ₯Ό 바라며, λ‹€μŒμ— λ‹€μ‹œ μƒˆλ‘œμš΄ workroad λ“€κ³  μ˜¬κ²Œμš”! 총총

 

λ°˜μ‘ν˜•