::: Zany's Homepage ::: Zany Wiki | 사이트 통합 검색
 
 
 

일반계정으로 MySQL Linux Generic (compressed tar) 설치 - v5.7.x

게시판
MySQL
작성자
Zany
작성일
2018-05-07 01:47:31
읽은수
272
평점
   
표시옵션
HTML사용 | 자동BR태그 | 공백문자허용 | 가운데정렬 | 고정폭글꼴 | 자동URL링크 | 마우스선택
● MySQL 5.7.x Linux Generic (compressed tar) 설치 - centos, mac os x 에서 테스트 됨.

● 사전 라이브러리 설치 작업 (root 권한 필요)
minimal 옵션으로 설치된 centos 에서는 mysql initialize 시 아래와 같은 라이브러리 오류가 발생한다.
CentOS 패키지 매니저(yum)를 사용하여 필요한 라이브러리를 설치해준다.
(root 권한이 필요한 작업이다)
[zany@c68test mysql]$ bin/mysqld --initialize --user=zany
bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

yum install libaio

[zany@c68test mysql]$ bin/mysqld --initialize --user=zany
bin/mysqld: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory

yum install numactl

● OS 파라미터 수정 (root 권한 필요)
mysql initialize 시 아래와 같이 max_open_files 설정 경고가 표시되는 경우, 
해당 계정에 적절한 임계값을 설정해 준다.
(root 권한이 필요한 작업이다)
[zany@c68test mysql]$ bin/mysqld --initialize --user=zany
mysqld: Can't create directory '/var/lib/mysql/' (Errcode: 13 - Permission denied)
2018-05-07T01:11:06.718546Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2018-05-07T01:11:06.718950Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2018-05-07T01:11:06.719455Z 0 [Warning] Ignoring user change to 'zany' because the user was set to 'mysql' earlier on the command line

2018-05-07T01:11:06.719494Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-05-07T01:11:06.720751Z 0 [ERROR] Can't find error-message file '/usr/local/mysql/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2018-05-07T01:11:06.722953Z 0 [ERROR] Aborting
http://home.zany.kr:9003/board/bView.asp?bCode=11&aCode=14200 참고하여 
vi /etc/security/limits.conf
vi /etc/security/limits.d/90-nproc.conf 파일에
mysql 기동 계정에 대한 적절한 임계치 설정.

● mysql initialize
[zany@c68test mysql]$ bin/mysqld --initialize --user=zany --basedir=$MYSQL_HOME --datadir=$MYSQL_HOME/data
2018-05-07T01:25:17.999144Z 0 [Warning] Ignoring user change to 'zany' because the user was set to 'mysql' earlier on the command line

2018-05-07T01:25:17.999328Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-05-07T01:25:18.012145Z 0 [Warning] One can only use the --user switch if running as root

2018-05-07T01:25:18.495011Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-05-07T01:25:18.635788Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-05-07T01:25:18.758494Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 80cb4d7f-5195-11e8-93f8-000c29ba7bf4.
2018-05-07T01:25:18.764621Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-05-07T01:25:18.780941Z 1 [Note] A temporary password is generated for root@localhost: 6Y/h8.L!p;Ki

★ 윗줄, root 임시 비밀번호가 발급되었다고 표시된다 - 6Y/h8.L!p;Ki

● mysql ssl rsa setup
[zany@c68test mysql]$ bin/mysql_ssl_rsa_setup --basedir=$MYSQL_HOME --datadir=$MYSQL_HOME/data
Generating a 2048 bit RSA private key
..................................................+++
........+++
writing new private key to 'ca-key.pem'
-----
Generating a 2048 bit RSA private key
...................................................................................................................................................+++
...+++
writing new private key to 'server-key.pem'
-----
Generating a 2048 bit RSA private key
..........................................................................+++
......................................................+++
writing new private key to 'client-key.pem'
-----

● 관련 스크립트 작업
● 아래 링크를 참고하여 기동,종료,프로세스확인 등의 스크립트를 생성하고 my.cnf 환경 파일을 구성한다.
http://home.zany.kr:9003/board/bView.asp?bCode=18&aCode=14307

● mysql 기동
앞서 만든 스크립트를 사용하여 mysql 을 기동한다.
[zany@c68test bin]$ mysql-start 
-----------------------------------
daemoncmd  : /home/zany/usr/tools/mysql/bin/mysqld_safe
-----------------------------------
defaults-file : /home/zany/usr/tools/mysql/my.cnf
ledir         : /home/zany/usr/tools/mysql/bin
basedir       : /home/zany/usr/tools/mysql
-----------------------------------
zany       2557   2556  2 11:22 pts/2    00:00:00 /bin/sh /home/zany/usr/tools/mysql/bin/mysqld_safe --defaults-file=/home/zany/usr/tools/mysql/my.cnf --ledir=/home/zany/usr/tools/mysql/bin --basedir=/home/zany/usr/tools/mysql
zany       2734   2557 26 11:22 pts/2    00:00:00 /home/zany/usr/tools/mysql/bin/mysqld --defaults-file=/home/zany/usr/tools/mysql/my.cnf --basedir=/home/zany/usr/tools/mysql --datadir=/home/zany/usr/tools/mysql/data --plugin-dir=/home/zany/usr/tools/mysql/lib/plugin --log-error=/home/zany/usr/tools/mysql/log/mysqld-err.log --pid-file=/home/zany/usr/tools/mysql/tmp/mysqld.pid --socket=/home/zany/usr/tools/mysql/tmp/mysql.sock


● mysql root login
[zany@c68test bin]$ mysql -u root -p
Enter password: 위에 표시된 임시 비밀번호 입력

mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('내비밀번호');

참고) mysql 5.7 Linux Generic 공식 설치 매뉴얼
https://dev.mysql.com/doc/refman/5.7/en/binary-installation.html
shell> groupadd mysql
shell> useradd -r -g mysql -s /bin/false mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> mkdir mysql-files
shell> chown mysql:mysql mysql-files
shell> chmod 750 mysql-files
shell> bin/mysqld --initialize --user=mysql 
shell> bin/mysql_ssl_rsa_setup
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server

게시물이 도움이 되셨으면 +1 을 눌러주세요~
 게시판 글 목록
No Subject Poster Hits Posted
14307 Zany 181 2018-05-07 02:15:24
Zany 272 2018-05-07 01:47:31
13492 Zany 1227 2016-07-06 02:36:36
9622 Zany 2291 2014-10-31 10:55:42
8757 Zany 1830 2014-07-04 13:14:50
8275 Zany 1961 2014-05-06 10:34:10
7044 Zany 2086 2013-12-10 14:18:14
댓글 달기 - 이 글이 도움이 되었거나 흥미로우셨다면, 댓글을 남겨주세요.(^^)(oo)(__)
작성자
                       
 
zany.kr
  Copyright ⓒ 2002-2010 Zany's Programming Lab. All Rights Not Reserved.
temporary This Page loads on 0.047 Secs