2024. 7. 15. 11:29

사이트이전 3) Centos 7 / MySql 5.5

----  MySQL 5.6

yum install http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

 

 

----  설치 진행 Installation & setting

yum install mysql-community-server

 

 

----  시스템 시작시 진행

systemctl enable mysqld
systemctl start mysqld

 

 

----  Yum으로 설치하고 mysql을 처음 구동하면, 초기 root 패스워드는 랜덤으로 생성됩니다. 초기 패스워드는 아래와 같은 명령으로 확인 가능합니다.

grep 'password' /var/log/mysqld.log
 
 
 
root@mysql57_02:~]# grep 'password' /var/log/mysqld.log
2020-01-07T18:21:05.473168Z 1 [Note] A temporary password is generated for root@localhost: ;iK0pIsOY6xu

 

 

---- root 패스워드와 보안 설정을 위해 다음 명령을 실행합니다.

mysql_secure_installation
 
 
 

 

Securing the MySQL server deployment.
 
Enter password for user root:
 
The existing password for the user account root has expired. Please set a new password.
 
New password:
 
Re-enter new password:
The 'validate_password' plugin is installed on the server.
The subsequent steps will run with the existing configuration
of the plugin.
Using existing password for root.
 
Estimated strength of the password: 100
Change the password for root ? ((Press y|Y for Yes, any other key for No) : y
 
New password:
 
Re-enter new password:
 
Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
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? (Press y|Y for Yes, any other key for No) : 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? (Press y|Y for Yes, any other key for No) : n
 
... skipping.
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? (Press y|Y for Yes, any other key for No) : 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? (Press y|Y for Yes, any other key for No) : y
Success.
 
 
 
All done!

처음 실행하면 임시 패스워드로 로그인 할 수 있고, 로그인하자마자 패스워드가 exprie 되었다고 나옵니다.

새로운 패스워드를 입력하는 창이 나오고, 입력하면 root 패스워드를 바꿀것인지 또 묻습니다.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y

anonymous 계정을 제거할 건지 묻습니다. 인증된 계정만 접속되어야 합니다.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n

원격으로 root 계정 로그인을 차단할 것인지 묻습니다.

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y

Test DB를 삭제하고 접속 제한할 것인지를 묻습니다.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y

설정한 것들을 저장할 것인지 묻습니다.