1) 설치
wget -P /root/src/ http://mysql.mirror.facebook.net/Downloads/MySQL-5.5/mysql-5.5.62.tar.gz
cd /root/src; tar xvzf mysql-5.5.62.tar.gz; cd mysql-5.5.62
cmake -DCMAKE_INSTALL_PREFIX=/opt/mysql -DWITH_SSL=yes -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_DATADIR=/opt/mysql/var -DSYSCONFDIR=/etc -DMYSQL_USER=mysql
make -j `grep processor /proc/cpuinfo | wc -l`; make install
useradd -M -s /bin/false mysql
chown -R mysql.mysql /opt/mysql/
cd /opt/mysql/scripts
(1번째 방법) /opt/mysql/scripts/mysql_install_db --basedir=/opt/mysql --datadir=/opt/mysql/var
(2번째 방법)
./mysql_install_db \
--user=mysql --basedir=/opt/mysql/ \
--datadir=/opt/mysql/var \
--defaults-file=/etc/my.cnf
cp -a /opt/mysql/support-files/my-medium.cnf /etc/my.cnf
/opt/mysql/support-files/mysql.server start
2) /etc/my.cnf 설정
[mysqld]
init_connect=SET collation_connection=utf8_general_ci
init_connect=SET NAMES utf8
character-set-server=utf8
collation-server=utf8_general_ci
table_open_cache=1024
max_connections=2048
max_user_connections=500
max_connect_errors=10000
wait_timeout=300
query_cache_type=1
query_cache_size=128M
query_cache_limit=5M
slow_query_log
long_query_time=3
max_allowed_packet=16M
sort_buffer_size=2M
skip-name-resolve
symbolic-links=0
[mysql]
default-character-set=utf8
3) 구동 스크립트 수정
[root@q352-4309 /]# vim /opt/mysql/share/mysql/mysql.server
basedir=/opt/mysql
datadir=/opt/mysql/var
4) MySQL 서비스 구동 및 접속 확인
[root@q352-4309 /]# /opt/mysql/share/mysql/mysql.server start
Starting MySQL. SUCCESS!
[root@q352-4309 /]# netstat -nltp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 17345/mysqld
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1535/sshd
tcp 0 0 :::5000 :::* LISTEN 1555/thttpd
tcp 0 0 :::22 :::* LISTEN 1535/sshd
[root@q352-4309 /]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
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>
'On-premise > Mysql, Mariadb' 카테고리의 다른 글
| mysql-5.6.46 소스 설치 (0) | 2023.11.06 |
|---|---|
| Mysql Lock 걸린 부분 모두 Kill 처리 방법 (0) | 2023.11.06 |
| slow(슬로우) 쿼리 설정 방법 (0) | 2023.11.06 |
| Mysql dump 및 restore 관련 (0) | 2023.11.06 |
| Mysql 패스워드 설정 (root 패스워드 설정) (0) | 2023.11.05 |