MYSQL 5.7 INSTALL ( mysql-comunity-server-5.7.9)
O/S : Centos 6.x (64bit)
1. yum 서버를 이용하여 mysql 5.7.9 버전의 mysql을 설치해 보자
1 2 3 4 5 6 7 8 9 10 11 12 |
[root@localhost ~]# wget http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm [root@localhost ~]# rpm -Uvh mysql57-community-release-el6-7.noarch.rpm [root@localhost ~]# yum install mysql-community-server [root@localhost ~]# rpm -qa | grep mysql mysql-community-server-5.7.9-1.el6.x86_64 mysql-community-common-5.7.9-1.el6.x86_64 mysql-community-libs-5.7.9-1.el6.x86_64 mysql-community-client-5.7.9-1.el6.x86_64 mysql57-community-release-el6-7.noarch |
2. mysqld start
1 2 3 |
[root@localhost ~]# /etc/rc.d/init.d/mysqld start MySQL 데이타베이스 초기화 중: [ OK ] mysqld (을)를 시작 중: [ OK ] |
3. mysql 5.7 버전에서는 시작시 패스워드가 임으로 할당되서 바로 root로 접속할수가 없다
1 2 |
[root@localhost ~]# mysql -u root ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) |
4. mysql데몬은 stop하고 safe 모드로 시작을 진행해서 패스워드를 변경하면 된다.
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
[root@localhost ~]# mysql.server stop Shutting down MySQL.. SUCCESS! [root@localhost ~]# /usr/bin/mysqld_safe --skip-grant-tables & [root@localhost ~]# mysql mysql> \s -------------- mysql Ver 14.14 Distrib 5.7.9, for Linux (x86_64) using EditLine wrapper Connection id: 2 Current database: Current user: root@ SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server version: 5.7.9 MySQL Community Server (GPL) Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: latin1 Db characterset: latin1 Client characterset: euckr Conn. characterset: euckr UNIX socket: /var/lib/mysql/mysql.sock Uptime: 19 sec mysql> flush privileges; mysql> use mysql; Database changed mysql> UPDATE user SET authentication_string=PASSWORD('qwer1234##$$') WHERE User = 'root'; Query OK, 1 row affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 1 mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) [root@localhost ~]# mysql.server stop Shutting down MySQL..151123 13:21:44 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended SUCCESS! [1]+ Done /usr/bin/mysqld_safe --skip-grant-tables |
5. mysql 패스워드 정책을 LOW 로 변경 후 mysql 데몬을 올릴수 있도록
1 2 3 4 5 6 7 8 |
[root@localhost ~]# vi /etc/my.cnf [mysqld] validate_password_policy=LOW [root@localhost ~]# /etc/rc.d/init.d/mysqld start mysqld (을)를 시작 중: [ OK ] |
6. 위에서 패스워드 지정한 패스워드로 이제 로그인을 해보자
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
[root@localhost ~]# mysql -u root -p mysql Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.7.9 Copyright (c) 2000, 2015, 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> \s ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. mysql> |
그럼 에러가 발생된다 에러는
You must reset your password using ALTER USER statement before executing this statement.
즉 root의 패스워드를 다시 한번 입력하라는 메세지이다
7. 패스워드 alter 명령어로 입력
1 2 3 4 5 |
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'qwer1234##$$'; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) |
8. 다시 재 로그인을 해보면 이제 패스워드 지정이 완벽하게 구성된 것을 확인 할 수 있다.
my.cnf (default-storage-engine = InnoDB)
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
[root@localhost ~]# vi /etc/my.cnf [client] default-character-set = utf8 port = 3306 socket = /var/lib/mysql/mysql.sock # default character set settings #default-character-set = utf8 [mysqld] socket=/var/lib/mysql/mysql.sock datadir=/var/lib/mysql # 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 #dns query skip-name-resolve #connection max_connections = 1000 max_connect_errors = 1000 wait_timeout= 60 #slow-queries slow_query_log = /var/lib/mysql/slow-queries.log long_query_time = 3 #log-slow-queries = /var/lib/mysql/mysql-slow-queries.log symbolic-links=0 ### log log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid ###chracter character-set-client-handshake=FALSE init_connect = SET collation_connection = utf8_general_ci init_connect = SET NAMES utf8 character-set-server = utf8 collation-server = utf8_general_ci symbolic-links=0 ##Password Policy validate_password_policy=LOW #validate_password_policy=MEDIUM ### MyISAM Spectific options #default-storage-engine = myisam key_buffer_size = 32M bulk_insert_buffer_size = 64M myisam_sort_buffer_size = 128M myisam_max_sort_file_size = 10G myisam_repair_threads = 1 ### INNODB Spectific options default-storage-engine = InnoDB #skip-innodb #innodb_additional_mem_pool_size = 16M #innodb_buffer_pool_size = 1024MB #innodb_data_file_path = ibdata1:10M:autoextend innodb_write_io_threads = 8 innodb_read_io_threads = 8 innodb_thread_concurrency = 16 innodb_flush_log_at_trx_commit = 1 innodb_log_buffer_size = 8M innodb_log_file_size = 128M innodb_log_files_in_group = 3 innodb_max_dirty_pages_pct = 90 innodb_lock_wait_timeout = 120 |
여기서 default-storagne-engin을 myisam 을 사용할것인지 innodb를 사용할것인지 선택 후 사용하면 된다
여기 my.cnf 파일은 현재 innodb를 기본엔진으로 사용
myisam으로 변경하려면 주석 해제 후 사용 / innodb 부분은 주석처리
Warning: Use of undefined constant bbse_list_comments_callback - assumed 'bbse_list_comments_callback' (this will throw an Error in a future version of PHP) in /free/home/xinet/html/wp-content/themes/Blog_Shop/comments.php on line 79
설치시 임의로 생성된 패스워드는 홈디렉토리인가에 .mysql_secret 으로 생성 됩니다.