์ด์ ์ MySQL ํจํค์ง ์ค์นํ๋ ๊ฒ์ ํ๋ค.
์ด๋ฒ์๋ MySQL ์์ค ์ปดํ์ผ ์ค์นํ๋ ๊ฒ์ ํ ๊ฑฐ๋ค.
๋์ค ์ด๋ ๋ฐฉ๋ฒ์ผ๋ก ์ค์นํด์ ์ฌ์ฉํด๋ ์๊ด ์์ง๋ง... ์ค์นํ ํ๋ก๊ทธ๋จ๋ค์ ๊ณ์ ๋ด์ ํ ํด๋์์ ๊ด๋ฆฌํ๊ธฐ ์ํด ์ปดํ์ผ ์ค์น๋ฅผ ํ ๊ฒ์ด๋ค.
https://downloads.mysql.com/archives/
MySQL Communitiy Server ํด๋ฆญ
ํ์๋ 5.7.20๋ฒ์ ์ ์ค์นํ๋ค.
๋ค์ด๋ก๋ ๋งํฌ ์ฃผ์๋ฅผ ๋ณต์ฌํ๋ค.
wget์ผ๋ก ์ค์นํ์ผ์ ๋ฐ๊ณ ํ์ด์ค๋ค.
1 2 3 4 5 | [jamong@localhost ~]$ cd dev_util [jamong@localhost dev_util]$ mkdir mysql [jamong@localhost dev_util]$ cd mysql/ [jamong@localhost mysql]$ wget https://downloads.mysql.com/archives/get/file/mysql-5.7.20.tar.gz [jamong@localhost mysql]$ tar xvfz mysql-5.7.20.tar.gz |
MySQL ์ปดํ์ผ ์ค์น๋ฅผ ์ํ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ค์นํ๊ณ ํ์ด์ค๋ค.
1 2 | [jamong@localhost mysql]$ wget http://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz [jamong@localhost mysql]$ tar xvfz boost_1_59_0.tar.gz |
์ปดํ์ผ ์ค์น๋ฅผ ์ํ ํจํค์ง๋ ์ค์นํ๋ค.
1 | [jamong@localhost mysql]$ sudo yum install cmake ncurses ncurses-devel | cs |
์ด์ ์ปดํ์ผ ์ค์น๋ฅผ ํ๊ณ my.cnfํ์ผ์ ์์ ํ๋ค.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | [jamong@localhost mysql]$ cd mysql-5.7.20/ [jamong@localhost mysql-5.7.20]$ cmake \ -DCMAKE_INSTALL_PREFIX=/home/jamong/dev_util/mysql \ -DWITH_EXTRA_CHARSETS=all \ -DMYSQL_DATADIR=/home/jamong/dev_util/mysql/mysql_data \ -DENABLED_LOCAL_INFILE=1 \ -DDOWNLOAD_BOOST=1 \ -DWITH_BOOST=../boost_1_59_0 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DWITH_FEDERATED_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DENABLED_LOCAL_INFILE=1 \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DSYSCONFDIR=/etc \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EXTRA_CHARSETS=all [jamong@localhost mysql-5.7.20]$ make [jamong@localhost mysql-5.7.20]$ make install [jamong@localhost mysql-5.7.20]$ make clean [jamong@localhost mysql-5.7.20]$ sudo vi /etc/my.cnf | cs |
my.cnf ํ์ผ
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 | [client] default-character-set = utf8 port = 3306 socket = /tmp/mysql.sock default-character-set = utf8 [mysqld] socket=/tmp/mysql.sock datadir=/home/jamong/dev_util/mysql/mysql_data basedir = /home/jamong/dev_util/mysql user = jamong bind-address = 0.0.0.0 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 skip-name-resolve max_connections = 1000 max_connect_errors = 1000 wait_timeout= 60 explicit_defaults_for_timestamp symbolic-links=0 log-error=/home/jamong/dev_util/mysql/mysql_data/mysqld.log pid-file=/tmp/mysqld.pid 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 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 |
mysql์ ์ค์นํ๋ค.
1 2 | [jamong@localhost etc]$ cd /home/jamong/dev_util/mysql/bin [jamong@localhost bin]$ ./mysql_install_db --user=jamong --datadir=/home/jamong/dev_util/mysql/mysql_data | cs |
์ด์ mysql server๋ฅผ ๋ฐ๋ก ์คํํ ์ ์๋๋ก ์ค์ ํ๊ณ ์คํํ๋ค.
1 2 3 4 | [jamong@localhost bin]$ cd /home/jamong/dev_util/mysql/support-files [jamong@localhost support-files]$ sudo cp mysql.server /usr/bin [jamong@localhost support-files]$ mysql.server start Starting MySQL. SUCCESS! |
mysql ๋ช ๋ น๋ ๋ณต์ฌํด์ค๋ค.
1 2 | [jamong@localhost support-files]$ cd /home/jamong/dev_util/mysql/bin [jamong@localhost bin]$ sudo cp mysql /usr/bin | cs |
์ด์ ๋ก๊ทธ์ธํด์ ์ฌ์ฉํ๋ฉด ๋๋๋ฐ, root์ ๋น๋ฐ๋ฒํธ๋ฅผ ๋ชจ๋ฅธ๋ค.
root ๋น๋ฐ๋ฒํธ๋ฅผ ์ค์ ํ๋ค.
mysql_secure_installation์ ์คํํด์ฃผ๋ฉด .mysql_secret ํ์ผ์ด ์์ฑ๋๋ฉด์ ์ด๊ธฐ ๋น๋ฐ๋ฒํธ๋ฅผ ๋ง๋ค์ด์ค๋ค.
์ดํ ๋น๋ฐ๋ฒํธ ์ฌ์ค์ ํ ๊บผ๋๊ณ ๋ฌผ์ด๋ณธ๋ค.
์ ๋ถ Yes๋ก ๋ตํด์ฃผ๊ณ ๋น๋ฐ๋ฒํธ ๊ฐ๋๋ ์ ๋นํ 1์ ์ ํํด์ค๋ค.
(์ซ์, ์๋ฌธ์, ๋๋ฌธ์, 8์์ด์์ ์กฐํฉ)
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 | [jamong@localhost bin]$ ./mysql_secure_installation mysql_secure_installation: [ERROR] unknown variable 'default-character-set=utf8' Securing the MySQL server deployment. Connecting to MySQL server using password in '/home/jamong/.mysql_secret' VALIDATE PASSWORD PLUGIN can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD plugin? Press y|Y for Yes, any other key for No: yes There are three levels of password validation policy: LOW Length >= 8 MEDIUM Length >= 8, numeric, mixed case, and special characters STRONG Length >= 8, numeric, mixed case, special characters and dictionary file Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1 Using existing password for root. Estimated strength of the password: 100 Change the password for root ? ((Press y|Y for Yes, any other key for No) : yes New password: Re-enter new password: Estimated strength of the password: 100 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : yes By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? (Press y|Y for Yes, any other key for No) : yes Success. Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? (Press y|Y for Yes, any other key for No) : yes Success. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? (Press y|Y for Yes, any other key for No) : yes - Dropping test database... Success. - Removing privileges on test database... Success. Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? (Press y|Y for Yes, any other key for No) : yes Success. |
์ค์ ํ ๋น๋ฐ๋ฒํธ๋ก mysql ์ ์์ ํด๋ณด์.
์ฟผ๋ฆฌ๋ฅผ ์น๋๊น.... ๋น๋ฐ๋ฒํธ๋ฅผ ๋ฐ๊ฟ์ฃผ๋ผ๊ณ ๋์จ๋ค....
๊ทธ๋ฅ ์์์ ๋น๋ฐ๋ฒํธ ๋ฐ๊พธ์ง ์๋๋ค๊ณ ํ๊ณ No๋กํด๋ ์๊ด์์๊ฒ๊ฐ๋ค.
ํ์ง๋ง, ์ด๊ธฐ๋น๋ฐ๋ฒํธ๋ ์คํํ๋ฅ ์ด ๋๊ธฐ ๋๋ฌธ์ ๊ทธ๋ฅ ๋ฐ๊ฟ์ฃผ๊ณ ํ๋ฒ ๋ ๋ฐ๊ฟ์ฃผ๋ ๊ฒ๋ ๋์์ง ์๋๋ฏ ํ๋ค.
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 | [jamong@localhost ~]$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 7 Server version: 5.7.20 Copyright (c) 2000, 2017, 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> show databases; ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. mysql> SET PASSWORD = PASSWORD('๋น๋ฐ๋ฒํธ'); Query OK, 0 rows affected, 1 warning (0.01 sec) mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.00 sec) |
๋.
๋๊ธ