MySQL

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page MySQL and the translation is 60% complete.
Outdated translations are marked like this.
Resources

MySQL은 인기있는 자유 소프트웨어 관계 데이터베이스 관리 시스템입니다. 종종(대부분의 PHP 사이트에서) 웹 프로그램과 결합하여 사용하지만, 1994년 이래로 기업체 요구 수준의 기능을 갖춰나갔습니다.

설치

USE flags

dev-db/mysql를 설치하기 전에, 꾸러미 배포와 기능에 영향을 주는 USE 플래그를 조심스레 고려하십시오. 다음 표에서는 꾸러미의 지원 USE 플래그 개요 정보를 보여줍니다:

USE flags for dev-db/mysql A fast, multi-threaded, multi-user SQL database server

cjk Add CJK support for InnoDB fulltext search using app-text/mecab
client-libs Build the client libraries from the server package instead of the C Connector packages (not recommended)
cracklib Support for cracklib strong password checking
debug Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces
experimental Build experimental features aka "rapid" plugins
jemalloc Use dev-libs/jemalloc for memory management
latin1 Use LATIN1 encoding instead of UTF8
numa Enable NUMA support using sys-process/numactl (NUMA kernel support is also required)
perl Add optional support/bindings for the Perl language
profiling Add support for statement profiling (requires USE=community).
router Build the MySQL router program
selinux !!internal use only!! Security Enhanced Linux support, this must be set by the selinux profile or breakage will occur
server Build the server program
static !!do not set this during bootstrap!! Causes binaries to be statically linked instead of dynamically
static-libs Build static versions of dynamic libraries as well
systemtap Build support for profiling and tracing using dev-debug/systemtap
tcmalloc Use the dev-util/google-perftools libraries to replace the malloc() implementation with a possibly faster one
test Install upstream testsuites for end use.

Emerge

USE 플래그를 설정하고 나면 dev-db/mysql를 설치하십시오:

root #emerge --ask mysql

설정

Service

OpenRC

부팅 과정에서 데이터베이스를 자동으로 시작하려면 mysql 시작 스크립트를 기본 런레벨에 추가하십시오:

root #rc-update add mysql default

데이터베이스 설정 후(이 문서의 뒷부분에 설명이 있음) mysql 서비스를 시작하십시오:

root #rc-service mysql start

준비 설정

dev-db/mysql 꾸러미는 --config 옵션을 통해 MySQL 준비 설정을 처리합니다:

root #emerge --config dev-db/mysql

이 명령은 데이터베이스를 만들고, root 암호를 만들 때 데이터 베이스에 적당한 권한을 설정합니다(이 결과로 나타나는게 MySQL root 계정이며 리눅스 root 계정과는 상관 없습니다).

익명 사용자와 시험 데이터베이스를 설치 과정에서 제거하려면, 준비 설정 과정에서 mysql_secure_installation를 실행하십시오:

root #mysql_secure_installation

데이터베이스 내 설정

데이터베이스를 띄워 가동중이라면 mysql 클라이언트 프로그램으로 데이터베이스에 연결하십시오.

user $mysql -u root -p -h localhost
Enter root password: 
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.5.1
  
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
  
mysql>

여기서, 질의 및 처리할 관리 명령을 허용하는 MySQL 인스턴스 세션을 엽니다.

명령 기록 지우기

기본적으로 MySQL은 일반 텍스트로 이루어진 암호까지 기록 파일에 모든 동작을 기록합니다.

이 기록 파일을 제거하려면;

root #rm /root/.mysql_history

대신 다음 명령을 사용하면 기록 기능을 완전히 비활성화할 수 있습니다:

root #ln -sf /dev/null /root/.mysql_history

추가 참조