MYSQL
HOME > DB > MYSQL
2019.01.05 / 16:15

[MySQL] Ubuntu 16.04 ¿¡¼­ MySQL ¼­¹ö ¼³Ä¡

hanulbit
Ãßõ ¼ö 185

[MySQL] Ubuntu 16.04 ¿¡¼­ MySQL ¼­¹ö ¼³Ä¡

OS: Ubuntu 16.04

# apt-get update
# apt-get install mysql-server

MySQL ¼­¹öÀÇ root °èÁ¤ÀÇ ¾ÏÈ£¸¦ ¼³Á¤ÇÑ´Ù. ÀÌ ¾ÏÈ£´Â ¼³Ä¡ ÈÄ ¹Ýµå½Ã ÇÊ¿äÇÏ´Ï ²À ¸Þ¸ðÇØ µÎµµ·Ï ÇÑ´Ù.

enter image description here

¼³Ä¡½Ã¿¡ ³ª¿À´Â ¸Þ½ÃÁöÀÌ´Ù.

ÆÐÅ°Áö ¸ñ·ÏÀ» Àд ÁßÀÔ´Ï´Ù... ¿Ï·á
ÀÇÁ¸¼º Æ®¸®¸¦ ¸¸µå´Â ÁßÀÔ´Ï´Ù       
»óÅ Á¤º¸¸¦ Àд ÁßÀÔ´Ï´Ù... ¿Ï·á
The following additional packages will be installed:
  apparmor libaio1 libapparmor-perl libcgi-fast-perl libcgi-pm-perl libencode-locale-perl libevent-core-2.0-5 libfcgi-perl
  libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl
  liblwp-mediatypes-perl libnuma1 libtimedate-perl liburi-perl mysql-client-5.7 mysql-client-core-5.7 mysql-common
  mysql-server-5.7 mysql-server-core-5.7 psmisc
Á¦¾ÈÇÏ´Â ÆÐÅ°Áö:
  apparmor-profiles apparmor-profiles-extra apparmor-docs apparmor-utils libdata-dump-perl libipc-sharedcache-perl libwww-perl
  mailx tinyca
´ÙÀ½ »õ ÆÐÅ°Áö¸¦ ¼³Ä¡ÇÒ °ÍÀÔ´Ï´Ù:
  apparmor libaio1 libapparmor-perl libcgi-fast-perl libcgi-pm-perl libencode-locale-perl libevent-core-2.0-5 libfcgi-perl
  libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl
  liblwp-mediatypes-perl libnuma1 libtimedate-perl liburi-perl mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server
  mysql-server-5.7 mysql-server-core-5.7 psmisc
0°³ ¾÷±×·¹À̵å, 25°³ »õ·Î ¼³Ä¡, 0°³ Á¦°Å ¹× 74°³ ¾÷±×·¹ÀÌµå ¾È ÇÔ.
19.5 M¹ÙÀÌÆ® ¾ÆÄ«À̺긦 ¹Þ¾Æ¾ß ÇÕ´Ï´Ù.
ÀÌ ÀÛ¾÷ ÈÄ 165 M¹ÙÀÌÆ®ÀÇ µð½ºÅ© °ø°£À» ´õ »ç¿ëÇÏ°Ô µË´Ï´Ù.
°è¼Ó ÇϽðڽÀ´Ï±î? [Y/n] 
¹Þ±â:1 http://ftp.daumkakao.com/ubuntu xenial-updates/main amd64 mysql-common all 5.7.17-0ubuntu0.16.04.2 [15.7 kB]
¹Þ±â:2 http://ftp.daumkakao.com/ubuntu xenial-updates/main amd64 libapparmor-perl amd64 2.10.95-0ubuntu2.6 [31.4 kB]
¹Þ±â:3 http://ftp.daumkakao.com/ubuntu xenial-updates/main amd64 apparmor amd64 2.10.95-0ubuntu2.6 [450 kB]
¹Þ±â:4 http://ftp.daumkakao.com/ubuntu xenial/main amd64 libaio1 amd64 0.3.110-2 [6,356 B]
¹Þ±â:5 http://ftp.daumkakao.com/ubuntu xenial/main amd64 libnuma1 amd64 2.0.11-1ubuntu1 [21.0 kB]
¹Þ±â:6 http://ftp.daumkakao.com/ubuntu xenial-updates/main amd64 mysql-client-core-5.7 amd64 5.7.17-0ubuntu0.16.04.2 [6,516 kB]
¹Þ±â:7 http://ftp.daumkakao.com/ubuntu xenial-updates/main amd64 mysql-client-5.7 amd64 5.7.17-0ubuntu0.16.04.2 [1,666 kB]
¹Þ±â:8 http://ftp.daumkakao.com/ubuntu xenial-updates/main amd64 mysql-server-core-5.7 amd64 5.7.17-0ubuntu0.16.04.2 [7,564 kB]
¹Þ±â:9 http://ftp.daumkakao.com/ubuntu xenial/main amd64 psmisc amd64 22.21-2.1build1 [48.0 kB]
¹Þ±â:10 http://ftp.daumkakao.com/ubuntu xenial-updates/main amd64 libevent-core-2.0-5 amd64 2.0.21-stable-2ubuntu0.16.04.1 [70.6 kB]
¹Þ±â:11 http://ftp.daumkakao.com/ubuntu xenial-updates/main amd64 mysql-server-5.7 amd64 5.7.17-0ubuntu0.16.04.2 [2,466 kB]
¹Þ±â:12 http://ftp.daumkakao.com/ubuntu xenial/main amd64 libhtml-tagset-perl all 3.20-2 [13.5 kB]
¹Þ±â:13 http://ftp.daumkakao.com/ubuntu xenial/main amd64 liburi-perl all 1.71-1 [76.9 kB]
¹Þ±â:14 http://ftp.daumkakao.com/ubuntu xenial/main amd64 libhtml-parser-perl amd64 3.72-1 [86.1 kB]
¹Þ±â:15 http://ftp.daumkakao.com/ubuntu xenial/main amd64 libcgi-pm-perl all 4.26-1 [185 kB]
¹Þ±â:16 http://ftp.daumkakao.com/ubuntu xenial/main amd64 libfcgi-perl amd64 0.77-1build1 [32.3 kB]
¹Þ±â:17 http://ftp.daumkakao.com/ubuntu xenial/main amd64 libcgi-fast-perl all 1:2.10-1 [10.2 kB]
¹Þ±â:18 http://ftp.daumkakao.com/ubuntu xenial/main amd64 libencode-locale-perl all 1.05-1 [12.3 kB]
¹Þ±â:19 http://ftp.daumkakao.com/ubuntu xenial/main amd64 libhtml-template-perl all 2.95-2 [60.4 kB]
¹Þ±â:20 http://ftp.daumkakao.com/ubuntu xenial/main amd64 libtimedate-perl all 2.3000-2 [37.5 kB]
¹Þ±â:21 http://ftp.daumkakao.com/ubuntu xenial/main amd64 libhttp-date-perl all 6.02-1 [10.4 kB]
¹Þ±â:22 http://ftp.daumkakao.com/ubuntu xenial/main amd64 libio-html-perl all 1.001-1 [14.9 kB]
¹Þ±â:23 http://ftp.daumkakao.com/ubuntu xenial/main amd64 liblwp-mediatypes-perl all 6.02-1 [21.7 kB]
¹Þ±â:24 http://ftp.daumkakao.com/ubuntu xenial/main amd64 libhttp-message-perl all 6.11-1 [74.3 kB]
¹Þ±â:25 http://ftp.daumkakao.com/ubuntu xenial-updates/main amd64 mysql-server all 5.7.17-0ubuntu0.16.04.2 [10.8 kB]
³»·Á¹Þ±â 19.5 M¹ÙÀÌÆ®, ¼Ò¿ä½Ã°£ 5ÃÊ (3,442 k¹ÙÀÌÆ®/ÃÊ)
ÆÐÅ°Áö¸¦ ¹Ì¸® ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù...
Selecting previously unselected package mysql-common.
(µ¥ÀÌÅͺ£À̽º ÀдÂÁß ...ÇöÀç 14946°³ÀÇ ÆÄÀÏ°ú µð·ºÅ͸®°¡ ¼³Ä¡µÇ¾î ÀÖ½À´Ï´Ù.)
Preparing to unpack .../mysql-common_5.7.17-0ubuntu0.16.04.2_all.deb ...
Unpacking mysql-common (5.7.17-0ubuntu0.16.04.2) ...
Selecting previously unselected package libapparmor-perl.
Preparing to unpack .../libapparmor-perl_2.10.95-0ubuntu2.6_amd64.deb ...
Unpacking libapparmor-perl (2.10.95-0ubuntu2.6) ...
Selecting previously unselected package apparmor.
Preparing to unpack .../apparmor_2.10.95-0ubuntu2.6_amd64.deb ...
Unpacking apparmor (2.10.95-0ubuntu2.6) ...
Selecting previously unselected package libaio1:amd64.
Preparing to unpack .../libaio1_0.3.110-2_amd64.deb ...
Unpacking libaio1:amd64 (0.3.110-2) ...
Selecting previously unselected package libnuma1:amd64.
Preparing to unpack .../libnuma1_2.0.11-1ubuntu1_amd64.deb ...
Unpacking libnuma1:amd64 (2.0.11-1ubuntu1) ...
Selecting previously unselected package mysql-client-core-5.7.
Preparing to unpack .../mysql-client-core-5.7_5.7.17-0ubuntu0.16.04.2_amd64.deb ...
Unpacking mysql-client-core-5.7 (5.7.17-0ubuntu0.16.04.2) ...
Selecting previously unselected package mysql-client-5.7.
Preparing to unpack .../mysql-client-5.7_5.7.17-0ubuntu0.16.04.2_amd64.deb ...
Unpacking mysql-client-5.7 (5.7.17-0ubuntu0.16.04.2) ...
Selecting previously unselected package mysql-server-core-5.7.
Preparing to unpack .../mysql-server-core-5.7_5.7.17-0ubuntu0.16.04.2_amd64.deb ...
Unpacking mysql-server-core-5.7 (5.7.17-0ubuntu0.16.04.2) ...
Selecting previously unselected package psmisc.
Preparing to unpack .../psmisc_22.21-2.1build1_amd64.deb ...
Unpacking psmisc (22.21-2.1build1) ...
Selecting previously unselected package libevent-core-2.0-5:amd64.
Preparing to unpack .../libevent-core-2.0-5_2.0.21-stable-2ubuntu0.16.04.1_amd64.deb ...
Unpacking libevent-core-2.0-5:amd64 (2.0.21-stable-2ubuntu0.16.04.1) ...
Processing triggers for systemd (229-4ubuntu10) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...
mysql-common (5.7.17-0ubuntu0.16.04.2) ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Selecting previously unselected package mysql-server-5.7.
(µ¥ÀÌÅͺ£À̽º ÀдÂÁß ...ÇöÀç 15287°³ÀÇ ÆÄÀÏ°ú µð·ºÅ͸®°¡ ¼³Ä¡µÇ¾î ÀÖ½À´Ï´Ù.)
Preparing to unpack .../mysql-server-5.7_5.7.17-0ubuntu0.16.04.2_amd64.deb ...
Unpacking mysql-server-5.7 (5.7.17-0ubuntu0.16.04.2) ...
Selecting previously unselected package libhtml-tagset-perl.
Preparing to unpack .../libhtml-tagset-perl_3.20-2_all.deb ...
Unpacking libhtml-tagset-perl (3.20-2) ...
Selecting previously unselected package liburi-perl.
Preparing to unpack .../liburi-perl_1.71-1_all.deb ...
Unpacking liburi-perl (1.71-1) ...
Selecting previously unselected package libhtml-parser-perl.
Preparing to unpack .../libhtml-parser-perl_3.72-1_amd64.deb ...
Unpacking libhtml-parser-perl (3.72-1) ...
Selecting previously unselected package libcgi-pm-perl.
Preparing to unpack .../libcgi-pm-perl_4.26-1_all.deb ...
Unpacking libcgi-pm-perl (4.26-1) ...
Selecting previously unselected package libfcgi-perl.
Preparing to unpack .../libfcgi-perl_0.77-1build1_amd64.deb ...
Unpacking libfcgi-perl (0.77-1build1) ...
Selecting previously unselected package libcgi-fast-perl.
Preparing to unpack .../libcgi-fast-perl_1%3a2.10-1_all.deb ...
Unpacking libcgi-fast-perl (1:2.10-1) ...
Selecting previously unselected package libencode-locale-perl.
Preparing to unpack .../libencode-locale-perl_1.05-1_all.deb ...
Unpacking libencode-locale-perl (1.05-1) ...
Selecting previously unselected package libhtml-template-perl.
Preparing to unpack .../libhtml-template-perl_2.95-2_all.deb ...
Unpacking libhtml-template-perl (2.95-2) ...
Selecting previously unselected package libtimedate-perl.
Preparing to unpack .../libtimedate-perl_2.3000-2_all.deb ...
Unpacking libtimedate-perl (2.3000-2) ...
Selecting previously unselected package libhttp-date-perl.
Preparing to unpack .../libhttp-date-perl_6.02-1_all.deb ...
Unpacking libhttp-date-perl (6.02-1) ...
Selecting previously unselected package libio-html-perl.
Preparing to unpack .../libio-html-perl_1.001-1_all.deb ...
Unpacking libio-html-perl (1.001-1) ...
Selecting previously unselected package liblwp-mediatypes-perl.
Preparing to unpack .../liblwp-mediatypes-perl_6.02-1_all.deb ...
Unpacking liblwp-mediatypes-perl (6.02-1) ...
Selecting previously unselected package libhttp-message-perl.
Preparing to unpack .../libhttp-message-perl_6.11-1_all.deb ...
Unpacking libhttp-message-perl (6.11-1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_5.7.17-0ubuntu0.16.04.2_all.deb ...
Unpacking mysql-server (5.7.17-0ubuntu0.16.04.2) ...
Processing triggers for systemd (229-4ubuntu10) ...
Processing triggers for ureadahead (0.100.0-19) ...
libapparmor-perl (2.10.95-0ubuntu2.6) ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù ...
apparmor (2.10.95-0ubuntu2.6) ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù ...
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
diff: /var/lib/apparmor/profiles/.apparmor.md5sums: No such file or directory
libaio1:amd64 (0.3.110-2) ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù ...
libnuma1:amd64 (2.0.11-1ubuntu1) ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù ...
mysql-client-core-5.7 (5.7.17-0ubuntu0.16.04.2) ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù ...
mysql-client-5.7 (5.7.17-0ubuntu0.16.04.2) ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù ...
mysql-server-core-5.7 (5.7.17-0ubuntu0.16.04.2) ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù ...
psmisc (22.21-2.1build1) ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù ...
libevent-core-2.0-5:amd64 (2.0.21-stable-2ubuntu0.16.04.1) ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù ...
mysql-server-5.7 (5.7.17-0ubuntu0.16.04.2) ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Renaming removed key_buffer and myisam-recover options (if present)
libhtml-tagset-perl (3.20-2) ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù ...
liburi-perl (1.71-1) ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù ...
libhtml-parser-perl (3.72-1) ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù ...
libcgi-pm-perl (4.26-1) ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù ...
libfcgi-perl (0.77-1build1) ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù ...
libcgi-fast-perl (1:2.10-1) ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù ...
libencode-locale-perl (1.05-1) ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù ...
libhtml-template-perl (2.95-2) ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù ...
libtimedate-perl (2.3000-2) ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù ...
libhttp-date-perl (6.02-1) ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù ...
libio-html-perl (1.001-1) ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù ...
liblwp-mediatypes-perl (6.02-1) ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù ...
libhttp-message-perl (6.11-1) ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù ...
mysql-server (5.7.17-0ubuntu0.16.04.2) ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù ...
Processing triggers for systemd (229-4ubuntu10) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...

¼³Ä¡µÈ MySQL ¹öÀüÀ» È®ÀÎÇØ º¼·Á¸é ¾Æ·¡¿Í °°ÀÌ dkpg ¸í·É¾î¸¦ ÀÌ¿ëÇÑ´Ù. MySQL 5.7 ¹öÀüÀ¸·Î ¼³Ä¡°¡ µÇ¾ú´Ù.

# dpkg --list | grep mysql
ii  mysql-client-5.7           5.7.17-0ubuntu0.16.04.2         amd64        MySQL database client binaries
ii  mysql-client-core-5.7      5.7.17-0ubuntu0.16.04.2         amd64        MySQL database core client binaries
ii  mysql-common               5.7.17-0ubuntu0.16.04.2         all          MySQL database common files, e.g. /etc/mysql/my.cnf
ii  mysql-server               5.7.17-0ubuntu0.16.04.2         all          MySQL database server (metapackage depending on the latest version)
ii  mysql-server-5.7           5.7.17-0ubuntu0.16.04.2         amd64        MySQL database server binaries and system database setup
ii  mysql-server-core-5.7      5.7.17-0ubuntu0.16.04.2         amd64        MySQL database server binaries

MySQL ¼­¹ö ½ÃÀÛ

# service mysql start

MySQL ¼­¹ö Á¾·á

# service mysql stop

¼³Á¤ ÆÄÀÏ À§Ä¡´Â /etc/mysql/my.cnf ÀÌ´Ù. ¾Æ·¡¿Í °°ÀÌ Å¬¶óÀ̾ðÆ®¿Í ¼­¹öÂÊ ¼³Á¤ ÆÄÀÏÀ» include Çϵµ·Ï µÇ¾î ÀÖ´Ù.

#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
# 
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

#
# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
#

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

¼­¹öÂÊ ¼³Á¤À» º¯°æÇÒ·Á¸é /etc/mysql/mysql/conf.d/mysqld.cnf ¸¦ ¼öÁ¤ÇÏ¸é µÈ´Ù. MySQL ¼­¹ö´Â Ãʱ⠼³Ä¡½Ã¿¡ ¹ÙÀεù ¾îµå·¹½º°¡ 127.0.0.1 ·Î µÇ¾î Àֱ⠶§¹®¿¡ ¸®¸ðÆ®¿¡¼­ Á¢¼ÓÀÌ ºÒ°¡ÇÏ´Ù. ¸®¸ðÆ®¿¡¼­ Á¢¼ÓÀ» ÇÒ·Á¸é ¾Æ·¡¿Í °°ÀÌ bind-address ¸¦ 0.0.0.0 À¸·Î ÇÑ ÈÄ MySQL ¼­¹ö¸¦ Àç½ÃÀÛÇÑ´Ù.

#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address            = 0.0.0.0

MySQL ¼­¹ö·Î Á¢¼ÓÇØ º»´Ù.

root@api_mysql_dev:~# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.17-0ubuntu0.16.04.2 (Ubuntu)

Copyright (c) 2000, 2016, 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>