우분투 MariaDB 설치

(마리아DB 설치에서 넘어옴)
  다른 뜻에 대해서는 CentOS MariaDB 설치 문서를 참조하십시오.
우분투 MariaDB 설치

1 (Optional) APT저장소 추가[ | ]

apt install python-software-properties
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://ftp.kaist.ac.kr/mariadb/repo/10.1/ubuntu xenial main'
apt update

2 확인[ | ]

root@zetawiki:~# apt list mariadb-server -a
Listing... Done
mariadb-server/xenial-updates,xenial-updates,xenial-security,xenial-security 10.0.31-0ubuntu0.16.04.2 all
mariadb-server/xenial,xenial 10.0.24-7 all

3 설치[ | ]

root@zetawiki:~# apt install mariadb-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libaio1 libcgi-fast-perl libcgi-pm-perl libdbd-mysql-perl libdbi-perl libencode-locale-perl
  libfcgi-perl libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl
  libhttp-message-perl libio-html-perl liblwp-mediatypes-perl libmysqlclient20 libtimedate-perl
  liburi-perl mariadb-client-10.0 mariadb-client-core-10.0 mariadb-common mariadb-server-10.0
  mariadb-server-core-10.0 mysql-common
Suggested packages:
  libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl libdata-dump-perl
  libipc-sharedcache-perl libwww-perl mailx mariadb-test tinyca
The following NEW packages will be installed:
  libaio1 libcgi-fast-perl libcgi-pm-perl libdbd-mysql-perl libdbi-perl libencode-locale-perl
  libfcgi-perl libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl
  libhttp-message-perl libio-html-perl liblwp-mediatypes-perl libmysqlclient20 libtimedate-perl
  liburi-perl mariadb-client-10.0 mariadb-client-core-10.0 mariadb-common mariadb-server
  mariadb-server-10.0 mariadb-server-core-10.0 mysql-common
0 upgraded, 24 newly installed, 0 to remove and 66 not upgraded.
Need to get 16.8 MB of archives.
After this operation, 146 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-common all 5.7.19-0ubuntu0.16.04.1 [15.7 kB]
Get:2 http://kr.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 mariadb-common all 10.0.31-0ubuntu0.16.04.2 [16.0 kB]
Get:3 http://kr.archive.ubuntu.com/ubuntu xenial/main amd64 libdbi-perl amd64 1.634-1build1 [743 kB]
... (생략)
Setting up libhttp-message-perl (6.11-1) ...################################################...] 
Setting up mariadb-server (10.0.31-0ubuntu0.16.04.2) ...######################################.] 
Processing triggers for libc-bin (2.23-0ubuntu9) ...###########################################] 
Processing triggers for systemd (229-4ubuntu17) ...
Processing triggers for ureadahead (0.100.0-19) ...

4 확인 2[ | ]

root@zetawiki:~# apt list mariadb-server -a
Listing... Done
mariadb-server/xenial-updates,xenial-updates,xenial-security,xenial-security,now 10.0.31-0ubuntu0.16.04.2 all [installed]
mariadb-server/xenial,xenial 10.0.24-7 all
root@zetawiki:~# netstat -tnlp | grep 3306
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      27469/mysqld 
root@zetawiki:~# ps 27469
  PID TTY      STAT   TIME COMMAND
27469 ?        Sl     0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-
root@zetawiki:~# /usr/sbin/mysqld -V
/usr/sbin/mysqld  Ver 10.0.31-MariaDB-0ubuntu0.16.04.2 for debian-linux-gnu on x86_64 (Ubuntu 16.04)
170829 20:55:00 [Note] /usr/sbin/mysqld (mysqld 10.0.31-MariaDB-0ubuntu0.16.04.2) starting as process 27699 ...
root@zetawiki:~# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 42
Server version: 10.0.31-MariaDB-0ubuntu0.16.04.2 Ubuntu 16.04

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)
MariaDB [(none)]> exit;
Bye
root@zetawiki:~#

5 보안 설정[ | ]

root@zetawiki:~# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n]
New password: P@ssw0rd
Re-enter new password: P@ssw0rd
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB 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? [Y/n]
 ... 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? [Y/n]
 ... Success!

By default, MariaDB 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? [Y/n]
 - 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? [Y/n]
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!
root@zetawiki:~#

6 자동시작 설정 확인[ | ]

root@zetawiki:~# sysv-rc-conf --list mysql
mysql        0:off	1:off	2:on	3:on	4:on	5:on	6:off

7 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}