일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- NetDrive
- Server
- 플로티노스
- short_open_tag
- 소도마
- mysl
- ExpanDrive
- A2000UA
- 아베로에스
- httpd
- VMware
- 피론
- RaiDrive
- 디아고라스
- php
- 아낙시만드로스
- 아이스키네스
- 크세노크라테스
- 아리스티포스
- 알키비아데스
- 다날
- 고르기아스
- 프톨레 마이오스
- 윈도우10
- CentOS
- PG
- 서버
- bridged
- 아낙사고라스
- 히파티아
- Today
- Total
개발자의 하루
APM설치-MySQL (CentOS 6.9) 본문
APM설치시 순서를 꼭 지킬 필요는 없지만 종속 라이브러리설치를 편하게 하기 위해
MySQL >>> Apache >>> PHP
순서로 설치하는 것이 좋습니다.
1. MySQL설치
# yum install mysql mysql-server mysql-devel mysql-libs -y
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: centos.mirror.cdnetworks.com
* extras: centos.mirror.cdnetworks.com
* updates: centos.mirror.cdnetworks.com
base | 3.7 kB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 1.4 MB 00:00
Resolving Dependencies
--> Running transaction check
---> Package mysql.x86_64 0:5.1.73-8.el6_8 will be installed
---> Package mysql-devel.x86_64 0:5.1.73-8.el6_8 will be installed
--> Processing Dependency: openssl-devel for package: mysql-devel-5.1.73-8.el6_8.x86_64
---> Package mysql-libs.x86_64 0:5.1.73-8.el6_8 will be installed
---> Package mysql-server.x86_64 0:5.1.73-8.el6_8 will be installed
--> Processing Dependency: perl-DBI for package: mysql-server-5.1.73-8.el6_8.x86_64
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.73-8.el6_8.x86_64
--> Processing Dependency: perl(DBI) for package: mysql-server-5.1.73-8.el6_8.x86_64
--> Running transaction check
---> Package openssl-devel.x86_64 0:1.0.1e-57.el6 will be installed
--> Processing Dependency: zlib-devel for package: openssl-devel-1.0.1e-57.el6.x86_64
--> Processing Dependency: krb5-devel for package: openssl-devel-1.0.1e-57.el6.x86_64
---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be installed
---> Package perl-DBI.x86_64 0:1.609-4.el6 will be installed
--> Running transaction check
---> Package krb5-devel.x86_64 0:1.10.3-65.el6 will be installed
--> Processing Dependency: libkadm5(x86-64) = 1.10.3-65.el6 for package: krb5-devel-1.10.3-65.el6.x86_64
--> Processing Dependency: libselinux-devel for package: krb5-devel-1.10.3-65.el6.x86_64
--> Processing Dependency: libcom_err-devel for package: krb5-devel-1.10.3-65.el6.x86_64
--> Processing Dependency: keyutils-libs-devel for package: krb5-devel-1.10.3-65.el6.x86_64
---> Package zlib-devel.x86_64 0:1.2.3-29.el6 will be installed
--> Running transaction check
---> Package keyutils-libs-devel.x86_64 0:1.4-5.el6 will be installed
---> Package libcom_err-devel.x86_64 0:1.41.12-23.el6 will be installed
---> Package libkadm5.x86_64 0:1.10.3-65.el6 will be installed
---> Package libselinux-devel.x86_64 0:2.0.94-7.el6 will be installed
--> Processing Dependency: libsepol-devel >= 2.0.32-1 for package: libselinux-devel-2.0.94-7.el6.x86_64
--> Processing Dependency: pkgconfig(libsepol) for package: libselinux-devel-2.0.94-7.el6.x86_64
--> Running transaction check
---> Package libsepol-devel.x86_64 0:2.0.41-4.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
====================================================================================================================================
Package Arch Version Repository Size
====================================================================================================================================
Installing:
mysql x86_64 5.1.73-8.el6_8 base 895 k
mysql-devel x86_64 5.1.73-8.el6_8 base 130 k
mysql-libs x86_64 5.1.73-8.el6_8 base 1.2 M
mysql-server x86_64 5.1.73-8.el6_8 base 8.6 M
Installing for dependencies:
keyutils-libs-devel x86_64 1.4-5.el6 base 29 k
krb5-devel x86_64 1.10.3-65.el6 base 504 k
libcom_err-devel x86_64 1.41.12-23.el6 base 33 k
libkadm5 x86_64 1.10.3-65.el6 base 143 k
libselinux-devel x86_64 2.0.94-7.el6 base 137 k
libsepol-devel x86_64 2.0.41-4.el6 base 64 k
openssl-devel x86_64 1.0.1e-57.el6 base 1.2 M
perl-DBD-MySQL x86_64 4.013-3.el6 base 134 k
perl-DBI x86_64 1.609-4.el6 base 705 k
zlib-devel x86_64 1.2.3-29.el6 base 44 k
Transaction Summary
====================================================================================================================================
Install 14 Package(s)
Total download size: 14 M
Installed size: 39 M
Downloading Packages:
(1/14): keyutils-libs-devel-1.4-5.el6.x86_64.rpm | 29 kB 00:00
(2/14): krb5-devel-1.10.3-65.el6.x86_64.rpm | 504 kB 00:00
(3/14): libcom_err-devel-1.41.12-23.el6.x86_64.rpm | 33 kB 00:00
(4/14): libkadm5-1.10.3-65.el6.x86_64.rpm | 143 kB 00:00
(5/14): libselinux-devel-2.0.94-7.el6.x86_64.rpm | 137 kB 00:00
(6/14): libsepol-devel-2.0.41-4.el6.x86_64.rpm | 64 kB 00:00
(7/14): mysql-5.1.73-8.el6_8.x86_64.rpm | 895 kB 00:00
(8/14): mysql-devel-5.1.73-8.el6_8.x86_64.rpm | 130 kB 00:00
(9/14): mysql-libs-5.1.73-8.el6_8.x86_64.rpm | 1.2 MB 00:00
(10/14): mysql-server-5.1.73-8.el6_8.x86_64.rpm | 8.6 MB 00:00
(11/14): openssl-devel-1.0.1e-57.el6.x86_64.rpm | 1.2 MB 00:00
(12/14): perl-DBD-MySQL-4.013-3.el6.x86_64.rpm | 134 kB 00:00
(13/14): perl-DBI-1.609-4.el6.x86_64.rpm | 705 kB 00:00
(14/14): zlib-devel-1.2.3-29.el6.x86_64.rpm | 44 kB 00:00
------------------------------------------------------------------------------------------------------------------------------------
Total 5.8 MB/s | 14 MB 00:02
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : mysql-libs-5.1.73-8.el6_8.x86_64 1/14
Installing : mysql-5.1.73-8.el6_8.x86_64 2/14
Installing : perl-DBI-1.609-4.el6.x86_64 3/14
Installing : perl-DBD-MySQL-4.013-3.el6.x86_64 4/14
Installing : zlib-devel-1.2.3-29.el6.x86_64 5/14
Installing : libcom_err-devel-1.41.12-23.el6.x86_64 6/14
Installing : libkadm5-1.10.3-65.el6.x86_64 7/14
Installing : libsepol-devel-2.0.41-4.el6.x86_64 8/14
Installing : libselinux-devel-2.0.94-7.el6.x86_64 9/14
Installing : keyutils-libs-devel-1.4-5.el6.x86_64 10/14
Installing : krb5-devel-1.10.3-65.el6.x86_64 11/14
Installing : openssl-devel-1.0.1e-57.el6.x86_64 12/14
Installing : mysql-devel-5.1.73-8.el6_8.x86_64 13/14
Installing : mysql-server-5.1.73-8.el6_8.x86_64 14/14
Verifying : keyutils-libs-devel-1.4-5.el6.x86_64 1/14
Verifying : libsepol-devel-2.0.41-4.el6.x86_64 2/14
Verifying : openssl-devel-1.0.1e-57.el6.x86_64 3/14
Verifying : perl-DBD-MySQL-4.013-3.el6.x86_64 4/14
Verifying : mysql-server-5.1.73-8.el6_8.x86_64 5/14
Verifying : perl-DBI-1.609-4.el6.x86_64 6/14
Verifying : libkadm5-1.10.3-65.el6.x86_64 7/14
Verifying : libcom_err-devel-1.41.12-23.el6.x86_64 8/14
Verifying : libselinux-devel-2.0.94-7.el6.x86_64 9/14
Verifying : mysql-devel-5.1.73-8.el6_8.x86_64 10/14
Verifying : zlib-devel-1.2.3-29.el6.x86_64 11/14
Verifying : krb5-devel-1.10.3-65.el6.x86_64 12/14
Verifying : mysql-5.1.73-8.el6_8.x86_64 13/14
Verifying : mysql-libs-5.1.73-8.el6_8.x86_64 14/14
Installed:
mysql.x86_64 0:5.1.73-8.el6_8 mysql-devel.x86_64 0:5.1.73-8.el6_8 mysql-libs.x86_64 0:5.1.73-8.el6_8
mysql-server.x86_64 0:5.1.73-8.el6_8
Dependency Installed:
keyutils-libs-devel.x86_64 0:1.4-5.el6 krb5-devel.x86_64 0:1.10.3-65.el6 libcom_err-devel.x86_64 0:1.41.12-23.el6
libkadm5.x86_64 0:1.10.3-65.el6 libselinux-devel.x86_64 0:2.0.94-7.el6 libsepol-devel.x86_64 0:2.0.41-4.el6
openssl-devel.x86_64 0:1.0.1e-57.el6 perl-DBD-MySQL.x86_64 0:4.013-3.el6 perl-DBI.x86_64 0:1.609-4.el6
zlib-devel.x86_64 0:1.2.3-29.el6
Complete!
CentOS6.9에서는 MySQL버전이 5.1버전이 설치되네요.
예전에는 소스파일을 받아 설치했는데 근래에는 RPM으로 설치해도 속도와 성능차이가 거의 안나기 때문에 yum설치를 권장합니다.
이제 기본적으로 정의되어 있는 설정파일을 상황에 맞게 복사합니다.
설치시 기본 설정 파일은 /etc/my.cnf 에 자동으로 생성됩니다.
MySQL 설정파일 위치 : /etc/my.cnf
MySQL 샘플 설정파일들은 /usr/share/mysql/ 에 있습니다.
[root@testserver ~]# ll /usr/share/mysql/*.cnf
-rw-r--r--. 1 root root 4688 2017-01-27 07:25 /usr/share/mysql/my-huge.cnf
-rw-r--r--. 1 root root 19751 2017-01-27 07:25 /usr/share/mysql/my-innodb-heavy-4G.cnf
-rw-r--r--. 1 root root 4662 2017-01-27 07:25 /usr/share/mysql/my-large.cnf
-rw-r--r--. 1 root root 4673 2017-01-27 07:25 /usr/share/mysql/my-medium.cnf
-rw-r--r--. 1 root root 2441 2017-01-27 07:25 /usr/share/mysql/my-small.cnf
[root@testserver ~]#
[MySQL 환경 설정]
my-innodb-heavy-4G 4G 이상 (시스템 메모리)
my-huge.cnf 1G 이상
my-large.cnf 512M ~ 1G
my-medium.cnf 128M ~ 256M
my-small.cnf 64M 이하
라고 하지만 MySQL 단독 서버의 경우를 기준으로 합니다.
서버 메모리가 4G 일 경우 MySQL 단독으로 사용할 경우에는 my-innodb-heavy-4G 도 가능하지만
아파치나 메일서버 네임서버등 각종 다른 데몬을 같이 사용할 경우에는 my-huge.cnf 를 사용하는 것이 좋습니다.
리눅스 서버 메모리 확인
[root@testserver ~]# top
top - 09:10:46 up 22:44, 1 user, load average: 0.00, 0.00, 0.00
Tasks: 133 total, 1 running, 132 sleeping, 0 stopped, 0 zombie
Cpu0 : 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu1 : 0.0%us, 0.3%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu2 : 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu3 : 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 1004112k total, 355372k used, 648740k free, 18328k buffers
Swap: 2031612k total, 0k used, 2031612k free, 199584k cached
PID USER PR NI VIRT RES SHR S %CPU TIME %MEM TIME+ COMMAND
1 root 20 0 19236 1504 1228 S 0.0 0:21 0.1 0:21.25 init
2 root 20 0 0 0 0 S 0.0 0:00 0.0 0:00.02 kthreadd
3 root RT 0 0 0 0 S 0.0 0:00 0.0 0:00.07 migration/0
4 root 20 0 0 0 0 S 0.0 0:00 0.0 0:00.07 ksoftirqd/0
5 root RT 0 0 0 0 S 0.0 0:00 0.0 0:00.00 stopper/0
6 root RT 0 0 0 0 S 0.0 0:00 0.0 0:00.09 watchdog/0
....
....
[root@testserver ~]# cat /proc/meminfo
MemTotal: 1004112 kB
MemFree: 648524 kB
Buffers: 18328 kB
Cached: 199584 kB
SwapCached: 0 kB
Active: 126292 kB
Inactive: 105088 kB
Active(anon): 13492 kB
Inactive(anon): 216 kB
Active(file): 112800 kB
Inactive(file): 104872 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 2031612 kB
SwapFree: 2031612 kB
Dirty: 0 kB
Writeback: 0 kB
...
...
[root@testserver ~]# free -h
total used free shared buffers cached
Mem: 980M 347M 633M 228K 17M 194M
-/+ buffers/cache: 134M 845M
Swap: 1.9G 0B 1.9G
다양한 방법으로 서버 메모리 용량과 Swap용량을 확인 가능합니다.
테스트 서버라 1G지만 가장 많이 사용된느 my-huge.cnf 파일로 진행하도고 하겠습니다.
[root@testserver ~]# cp /usr/share/mysql/my-huge.cnf /etc/my.cnf
cp: overwrite `/etc/my.cnf'? y
`/usr/share/mysql/my-huge.cnf' -> `/etc/my.cnf'
[root@testserver ~]# vi /etc/my.cnf
# Example MySQL config file for very large systems.
#
# This is for a large system with memory of 1G-2G where the system runs mainly
# MySQL.
#
# MySQL programs look for option files in a set of
# locations which depend on the deployment platform.
# You can copy this option file to one of those
# locations. For information about these locations, see:
# http://dev.mysql.com/doc/mysql/en/option-files.html
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.
# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /var/lib/mysql/mysql.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
#skip-locking
skip-external-locking
key_buffer_size = 384M
max_allowed_packet = 1M
table_open_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 32M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8
# *** slow Query *** 5초간 슬로우 쿼리 발생시 로그로 저장해서 추후 분석
long_query_time=5
slow_query_log_file=/var/log/mysql/mysql-slow-query.log
# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking
# Replication Master Server (default)
# binary logging is required for replication
log-bin=mysql-bin
# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id = 1
# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
# the syntax is:
#
# CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
# MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
# where you replace <host>, <user>, <password> by quoted strings and
# <port> by the master's port number (3306 by default).
#
# Example:
#
# CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
# MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
# start replication for the first time (even unsuccessfully, for example
# if you mistyped the password in master-password and the slave fails to
# connect), the slave will create a master.info file, and any later
# change in this file to the variables' values below will be ignored and
# overridden by the content of the master.info file, unless you shutdown
# the slave server, delete master.info and restart the slaver server.
# For that reason, you may want to leave the lines below untouched
# (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id = 2
#
# The replication master for this slave - required
#master-host = <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user = <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-password = <password>
#
# The port the master is listening on.
# optional - defaults to 3306
#master-port = <port>
#
# binary logging - not required for slaves, but recommended
#log-bin=mysql-bin
#
# binary logging format - mixed recommended
#binlog_format=mixed
# Uncomment the following if you are using InnoDB tables
innodb_data_home_dir = /var/lib/mysql
innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend
innodb_log_group_home_dir = /var/lib/mysql
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 300M
innodb_additional_mem_pool_size = 20M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 256M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 120
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
skip-locking의 경우 5.1에서는 skip-external-locking로 변경되었는데 샘플 설정파일에서는 그대로 skip-locking를 사용했다는게 의문입니다.
기본 설정에서 슬로우 쿼리 로그를 추가하고
thread_concurrency의 경우 해당 서버 CPU수 * 2로 설정해주시면 됩니다.
리눅스 CPU확인
# cat /proc/cpuinfo | grep processor
processor : 0
processor : 1
processor : 2
processor : 3
테스트 서버는 CPU수가 4개입니다.
특히 innodb설정에서 innodb_buffer_pool_size의 경우 매우 중요한 환경변수입니다.
innodb_buffer_pool_size는 InnoDB에서 테이블에 있는 데이터와 인덱스를 캐시하기 위해 사용하는 메모리 버퍼의 크기입니다.
이 값을 크게 하면 데이터를 접속하는데 필요한 I/O가 덜 생기지만
너무 크게 설정하게 되면 서버 메인 메모리 할당 경쟁이 생기기 때문에 오히려 더 느려집니다.
메뉴얼에는 서버 메모리의 50%-80%정도라 하지만
안정적인 서버 운영을 위해서는 20%-50%정도가 적당합니다.
실제 몇몇 운영중인 서버는 8G메모리에 2G만 설정하였습니다.
테스트 서버는 1G 메모리라 30%정도인 300M로 설정했습니다.
innodb_log_file_size는 메뉴얼상 innodb_buffer_pool_size의 25% 정도가 적당하고 하지만
실제 운영시 최소 크기는 256M이상 되어야 됩니다.
이제 설정은 끝났으니 기본 DB를 만들고 MySQL root 비밀번호를 설정해 줍니다.
[root@testserver ~]# mysql_install_db // 기본 DB를 생성합니다.
WARNING: The host 'testserver' could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h testserver password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/bin/mysqlbug script!
[root@testserver ~]# chown -R mysql:mysql /var/lib/mysql/ // 혹시 모를 소유자와 그룹을 변경시켜줍니다.
changed ownership of `/var/lib/mysql/mysql-bin.index' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql-bin.000006' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/servers.MYI' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/servers.frm' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/columns_priv.MYD' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/help_relation.MYI' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/func.MYI' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/slow_log.CSV' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/tables_priv.frm' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/tables_priv.MYD' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/slow_log.frm' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/columns_priv.MYI' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/help_category.MYD' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/time_zone.MYI' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/help_category.MYI' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/general_log.CSM' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/servers.MYD' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/procs_priv.MYD' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/general_log.frm' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/user.MYD' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/host.MYI' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/procs_priv.frm' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/host.frm' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/time_zone_transition_type.MYI' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/time_zone_leap_second.MYI' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/user.frm' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/help_keyword.MYD' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/time_zone.frm' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/help_keyword.MYI' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/ndb_binlog_index.MYD' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/time_zone_name.frm' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/time_zone.MYD' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/time_zone_leap_second.MYD' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/help_relation.MYD' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/event.MYD' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/help_keyword.frm' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/proc.frm' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/time_zone_name.MYI' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/procs_priv.MYI' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/general_log.CSV' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/time_zone_transition.frm' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/plugin.MYD' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/time_zone_name.MYD' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/help_topic.MYD' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/proc.MYD' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/help_topic.frm' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/time_zone_transition_type.MYD' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/db.frm' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/plugin.MYI' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/func.MYD' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/host.MYD' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/help_relation.frm' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/event.frm' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/columns_priv.frm' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/proc.MYI' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/user.MYI' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/ndb_binlog_index.MYI' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/db.MYD' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/event.MYI' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/time_zone_leap_second.frm' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/help_category.frm' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/db.MYI' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/ndb_binlog_index.frm' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/plugin.frm' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/time_zone_transition_type.frm' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/time_zone_transition.MYD' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/help_topic.MYI' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/slow_log.CSM' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/tables_priv.MYI' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/func.frm' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql/time_zone_transition.MYI' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql-bin.000003' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql-bin.000001' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql-bin.000002' to mysql:mysql
changed ownership of `/var/lib/mysql/test' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql-bin.000005' to mysql:mysql
changed ownership of `/var/lib/mysql/mysql-bin.000004' to mysql:mysql
ownership of `/var/lib/mysql/' retained as mysql:mysql
[root@testserver ~]# chkconfig mysqld on // 부팅시 서비스에 등록하여 자동 시작
[root@testserver ~]# service mysqld start // MySQL 시작
mysqld (을)를 시작중 : [ OK ]
[root@testserver ~]# mysqladmin -u root password "password" // MySQL root 비밀번호를 설정합니다.
[root@testserver ~]# mysql -uroot -p // MySQL 접속 테스트
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.73-log Source distribution
Copyright (c) 2000, 2013, 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> quit
Bye
[root@testserver ~]#
MySQL 설치와 실행은 모두 끝났지만 아직 몇가지 추가해 주어야 되는 부분이 남았습니다.
로그를 한번에 볼수 있게 묶고 설정파일에 있던 슬로우 쿼리 로그파일을 생성해 줍니다.
[root@testserver ~]# cd /var/log/
[root@testserver log]# mkdir mysql // mysql 로그를 받을 디렉토리를 생성
[root@testserver log]# cd mysql
[root@testserver mysql]# echo "" >> mysql-slow-query.log // 로그 파일이 자동생성되지 않기 때문에 생성
[root@testserver mysql]# ll /var/lib/mysql/*.err
-rw-r-----. 1 mysql root 1772 2017-06-01 10:00 /var/lib/mysql/testserver.err
[root@testserver mysql]# ln -s /var/lib/mysql/testserver.err // 각 서버마다 호스트에 따라 이름이 다 다르기 때문에 서버에 맞게 설정합니다.
`./testserver.err' -> `/var/lib/mysql/testserver.err'
[root@testserver mysql]# cd ..
[root@testserver log]# chown -R mysql:mysql mysql/ // 소유권을 mysql로 바꾸어줍니다.
changed ownership of `mysql/testserver.err' to mysql:mysql
changed ownership of `mysql/mysql-slow-query.log' to mysql:mysql
ownership of `mysql/' retained as mysql:mysql
[root@testserver log]# service mysqld restart // MySQL 재시작
mysqld 를 정지중 : [ OK ]
mysqld (을)를 시작 중 : [ OK ]
[root@testserver log]#
'Server' 카테고리의 다른 글
APM설치-Apache (CentOS 6.9) (0) | 2017.06.02 |
---|---|
robots.txt를 쉽게 만드는 법 (0) | 2017.06.01 |
logwatch 설치 - 시스템 로그 (0) | 2017.05.31 |
CentOS 6.9 설치 후 기본 설정 (4) | 2017.05.31 |
실전 서버 설치 CentOS 6.9 (0) | 2017.05.31 |