1. 그룹 및 사용자 생성
[root@localhost /]# groupadd mysql
[root@localhost /]# useradd -g mysql mysql
2. /etc/my.cnf 파일 수정
[mysqld]
user = mysql
port = 3306
basedir=/mysql
datadir=/mysql/data
socket=/tmp/mysql.sock
innodb_data_file_path=ibdata1:12M:autoextend
innodb_log_files_in_group=2
innodb_log_file_size=50M
[mysqld_safe]
log-error=/var/log/mysqld.log
3. 설치 Binary 파일 압축 해제
[root@localhost /]# tar -zvxf /mysql-5.7.15-linux-glibc2.5-x86_64.tar.gz
4. 심볼릭 링크 설정
[root@localhost /]# ln -s /mysql-5.7.15-linux-glibc2.5-x86_64/ mysql
[root@localhost /]# ll
lrwxrwxrwx 1 root root 36 2016-09-26 18:10 mysql -> /mysql-5.7.15-linux-glibc2.5-x86_64/
5. mysql data 디렉토리 생성
[root@localhost /]# mkdir /mysql/data
6. 디렉토리 권한 변경
[root@localhost /]# chown -R mysql.mysql /mysql
[root@localhost /]# chown -R mysql.mysql /mysql-5.7.15-linux-glibc2.5-x86_64/
7. mysql 초기화 작업 :5.7.6 이상 버전에서는 반드시 initialize를 수행 (mysql_install_db는 사용X)
[root@localhost mysql]# ./bin/mysqld –initialize –user=mysql
2016-09-26T10:03:04.170696Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use –explicit_defaults_for_timestamp server option (see documentation for more details).
2016-09-26T10:03:04.794569Z 0 [Warning] InnoDB: New log files created, LSN=45790
2016-09-26T10:03:04.893132Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-09-26T10:03:04.987088Z 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: 6ad0994c-83d0-11e6-bc46-000c297180b5.
2016-09-26T10:03:04.991179Z 0 [Warning] Gtid table is not ready to be used. Table ‘mysql.gtid_executed’ cannot be opened.
2016-09-26T10:03:04.996563Z 1 [Note] A temporary password is generated for root@localhost: ptpiGPrw)0Rc <- 임시 비밀번호
8. MySQL 서버 실행
[root@localhost mysql]# ./bin/mysqld_safe –user=mysql &
[1] 6879
[root@localhost mysql]# 2016-09-26T10:13:01.303590Z mysqld_safe Logging to ‘/var/log/mysqld.log’.
2016-09-26T10:13:01.341881Z mysqld_safe Starting mysqld daemon with databases from /mysql/data
9. MySQL client를 통해 서버 접속
[root@localhost mysql]# ./bin/mysql -u root -p
Enter password: ptpiGPrw)0Rc <임시 비밀번호 입력
10. 패스워드 변경
mysql> alter user ‘root’@’localhost’ identified by ‘newpassword’;
11. MySQL 서버 종료
[root@localhost mysql]# ./bin/mysqladmin -uroot -p shutdown
Enter password:
2016-09-26T10:16:38.921110Z mysqld_safe mysqld from pid file /mysql/data/localhost.LJM.pid ended
[1]+ Done ./bin/mysqld_safe –user=mysql