-
CentOS 8 - MySQL 설치하기Linux/CentOS 2021. 6. 17. 23:38
CentOS 8 - MySQL 설치하기
MySQL 설치
$ sudo dnf install mysql-server . . . Install 49 Packages Total download size: 46 M Installed size: 252 M Is this ok [y/N]: y
MySQL 실행
$ sudo systemctl start mysqld.service
MySQL 상태 체크
Active: active 인지를 확인해주면 됩니다.
$ sudo systemctl status mysqld ● mysqld.service - MySQL 8.0 database server Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2020-03-12 14:07:41 UTC; 1min 7s ago Main PID: 15723 (mysqld) Status: "Server is operational" Tasks: 38 (limit: 5056) Memory: 474.2M CGroup: /system.slice/mysqld.service └─15723 /usr/libexec/mysqld --basedir=/usr Mar 12 14:07:32 cent-mysql-3 systemd[1]: Starting MySQL 8.0 database server... Mar 12 14:07:32 cent-mysql-3 mysql-prepare-db-dir[15639]: Initializing MySQL database Mar 12 14:07:41 cent-mysql-3 systemd[1]: Started MySQL 8.0 database server.
MySQL 부팅과 동시에 자동 실행
$ sudo systemctl enable mysqld
MySQL 보안 관련 설정
$ sudo mysql_secure_installation Securing the MySQL server deployment. Connecting to MySQL using a blank password. VALIDATE PASSWORD COMPONENT can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD component? Press y|Y for Yes, any other key for No: Y There are three levels of password validation policy: LOW Length >= 8 MEDIUM Length >= 8, numeric, mixed case, and special characters STRONG Length >= 8, numeric, mixed case, special characters and dictionary file Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2 Please set the password for root here. 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
MySQL 설치 테스트
$ mysqladmin -u root -p version mysqladmin Ver 8.0.17 for Linux on x86_64 (Source distribution) 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. Server version 8.0.17 Protocol version 10 Connection Localhost via UNIX socket UNIX socket /var/lib/mysql/mysql.sock Uptime: 2 hours 52 min 37 sec Threads: 2 Questions: 20 Slow queries: 0 Opens: 131 Flush tables: 3 Open tables: 48 Queries per second avg: 0.001