[ë¤ìë³´ë ë§¥ìë]ì¤í°ë¸ì¡ì¤ ì(å¼) í리ì í ì´ì ìê³ëª
차례:
- 전제 조건
- 1 단계 : MySQL 리포지토리 구성
- 3 단계 : MySQL 설치 확인
- 4 단계 : MySQL 보안
- 5 단계 : 명령 줄에서 MySQL에 연결
- 데이터베이스 생성
- 테이블 만들기
- 결론
Debian 9 Stretch MySQL이 출시되면서 세계에서 가장 인기있는 오픈 소스 관계형 데이터베이스 관리 시스템은 더 이상 데비안 리포지토리에서 사용할 수 없으며 MariaDB는 기본 데이터베이스 시스템이되었습니다. MariaDB는 이전 버전과 호환되는 MySQL의 이진 드롭 인 대체품입니다.
이 튜토리얼에서는 MySQL Apt Repository의 Debian 9 머신에 MySQL을 설치하고 보호하는 방법을 보여줍니다. 응용 프로그램에 특정 요구 사항이 없으면 데비안 9의 기본 데이터베이스 시스템 인 MariaDB를 사용해야합니다.
전제 조건
이 학습서를 계속하기 전에 sudo 권한이있는 사용자로 로그인했는지 확인하십시오.
1 단계: MySQL 리포지토리 구성
MySQL APT 저장소를 시스템에 추가하려면 저장소 다운로드 페이지로 이동하여 다음 wget 명령을 사용하여 최신 릴리스 패키지를 다운로드하십시오.
wget
다운로드가 완료되면 다음 명령을 사용하여 릴리스 패키지를 설치하십시오.
sudo dpkg -i mysql-apt-config_0.8.10-1_all.deb
설치하려는 MySQL 버전을 선택할 수있는 구성 메뉴가 표시됩니다.
3 단계: MySQL 설치 확인
설치가 완료되면 MySQL 서비스가 자동으로 시작됩니다.
다음을 입력하여 MySQL 서비스 상태를 확인할 수 있습니다.
sudo systemctl status mysql
● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: Active: active (running) since Thu 2018-08-02 17:22:18 UTC; 18s ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process: 14797 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (co Main PID: 14832 (mysqld) Status: "SERVER_OPERATING" Tasks: 37 (limit: 4915) CGroup: /system.slice/mysql.service └─14832 /usr/sbin/mysqld
4 단계: MySQL 보안
mysql_secure_installation
명령을 실행하여 루트 비밀번호를 설정하고 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:
MySQL 사용자 비밀번호의 강도를 테스트하는 데 사용되는
VALIDATE PASSWORD PLUGIN
을 구성하라는 메시지가 표시됩니다. 암호 유효성 검사 정책에는 낮음, 중간 및 강력의 세 가지 수준이 있습니다. 비밀번호 확인 플러그인을 설정하지 않으려면
ENTER
누르
ENTER
.
Please set the password for root here. New password: Re-enter new password:
다음 프롬프트에서 MySQL 루트 사용자의 비밀번호를 설정하라는 메시지가 표시됩니다.
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): y Success. 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!
루트 암호를 설정하면 스크립트에서 익명 사용자를 제거하고 로컬 컴퓨터에 대한 루트 사용자 액세스를 제한하고 테스트 데이터베이스를 제거하라는 메시지도 표시됩니다. 모든 질문에“Y”(예)로 대답해야합니다.
5 단계: 명령 줄에서 MySQL에 연결
터미널을 통해 MySQL과 상호 작용하기 위해 MySQL 서버 패키지의 종속성으로 설치된 MySQL 클라이언트를 사용합니다.
루트 사용자 유형으로 MySQL 서버에 로그인하려면 다음을 수행하십시오.
mysql -u root -p
mysql_secure_installation
스크립트가 실행될 때 이전에 설정 한 루트 비밀번호를 입력하라는 프롬프트가 표시됩니다.
비밀번호를 입력하면 아래와 같이 MySQL 셸이 표시됩니다.
Welcome to the MySQL monitor. Commands end with; or \g. Your MySQL connection id is 10 Server version: 8.0.12 MySQL Community Server - GPL Copyright (c) 2000, 2018, 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>
데이터베이스 생성
MySQL 셸에 연결되면 다음 명령을 입력하여 새 데이터베이스를 만들 수 있습니다.
CREATE DATABASE new_database;
Query OK, 1 row affected (0.00 sec)
테이블 만들기
이제 데이터베이스를 만들었으므로 일부 데이터를 저장할 테이블을 만들 수 있습니다.
테이블을 만들기 위해 SQL 문을 실행하기 전에 데이터베이스에 연결해야합니다.
use new_database;
이 예에서는
id
,
name
및
email
name
세 개의 필드가있는
contacts
라는 간단한 테이블을 만듭니다.
CREATE TABLE contacts (id INT PRIMARY KEY, name VARCHAR(30), email VARCHAR(30));
Query OK, 1 row affected (0.00 sec)
결론
이 튜토리얼에서는 데비안 9 서버에서 MySQL 서버를 설치하고 보호하는 방법을 보여주었습니다. 또한 MySQL 셸에 연결하는 방법과 새 데이터베이스 및 테이블을 만드는 방법도 보여주었습니다.
이제 MySQL 서버가 시작되어 명령 행에서 MySQL 서버에 연결하는 방법을 알았으므로 다음 안내서를 확인하십시오.
MySQL 데비안centos 8에 mysql을 설치하는 방법

기본 CentOS 8 리포지토리에서 최신 버전의 MySQL 데이터베이스 서버 버전 8.0을 설치할 수 있습니다. MySQL은 가장 널리 사용되는 오픈 소스 관계형 데이터베이스 관리 시스템입니다.
우분투 18.04에 mysql을 설치하는 방법

MySQL은 가장 널리 사용되는 오픈 소스 관계형 데이터베이스 관리 시스템입니다. 이 튜토리얼에서는 Ubuntu 18.04 시스템에서 MySQL을 설치하고 보안하는 방법을 보여줍니다.
데비안 10 리눅스에서 mysql을 설치하는 방법

세계에서 가장 많이 사용되는 오픈 소스 관계형 데이터베이스 관리 시스템 인 MySQL은 기본 데비안 리포지토리에서 사용할 수 없습니다. 이 튜토리얼에서는 MySQL Apt Repository에서 Debian 10에 MySQL을 설치하고 보호하는 방법을 설명합니다.