# mysql 이름이 mariadb 로 바뀌었습니다. root@AOL-Debian:~# apt install mariadb-server mariadb-client Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: galera-3 gawk libaio1 libatomic1 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 libjemalloc1 liblwp-mediatypes-perl libmariadbclient18 libmpfr4 libreadline5 libsigsegv2 libterm-readkey-perl libtimedate-perl liburi-perl lsof mariadb-client-10.1 mariadb-client-core-10.1 mariadb-common mariadb-server-10.1 mariadb-server-core-10.1 mysql-common psmisc rsync socat Suggested packages: gawk-doc libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl libdata-dump-perl libipc-sharedcache-perl libwww-perl mailx mariadb-test netcat-openbsd tinyca The following NEW packages will be installed: galera-3 gawk libaio1 libatomic1 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 libjemalloc1 liblwp-mediatypes-perl libmariadbclient18 libmpfr4 libreadline5 libsigsegv2 libterm-readkey-perl libtimedate-perl liburi-perl lsof mariadb-client mariadb-client-10.1 mariadb-client-core-10.1 mariadb-common mariadb-server mariadb-server-10.1 mariadb-server-core-10.1 mysql-common psmisc rsync socat 0 upgraded, 37 newly installed, 0 to remove and 6 not upgraded. Need to get 25.0 MB of archives. After this operation, 161 MB of additional disk space will be used. Do you want to continue? [Y/n]
# mariadb 를 구동하는 mysql 계정이 네트워크 권한을 갖게 합니다. root@AOL-Debian:~# adduser mysql aid_inet Adding user `mysql' to group `aid_inet' ... Adding user mysql to group aid_inet Done.
# mysql 을 시작합니다. root@AOL-Debian:~# service mysql start [ ok ] Starting MariaDB database server: mysqld.
2. phpmyadmin 설치 (apache2, php7)
# phpmyadmin 을 설치합니다. root@AOL-Debian:~# apt install phpmyadmin Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: apache2 apache2-bin apache2-data apache2-utils dbconfig-common dbconfig-mysql javascript-common libapache2-mod-php7.0 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libgd3 libjbig0 libjs-jquery libjs-sphinxdoc libjs-underscore liblua5.2-0 libtiff5 libxpm4 libzip4 php php-bz2 php-common php-curl php-gd php-mbstring php-mysql php-pear php-php-gettext php-phpseclib php-tcpdf php-xml php-zip php7.0 php7.0-bz2 php7.0-cli php7.0-common php7.0-curl php7.0-gd php7.0-json php7.0-mbstring php7.0-mysql php7.0-opcache php7.0-readline php7.0-xml php7.0-zip ssl-cert Suggested packages: www-browser apache2-doc apache2-suexec-pristine | apache2-suexec-custom libgd-tools php-libsodium php-mcrypt php-gmp php5-imagick openssl-blacklist Recommended packages: php5-gd php5-mcrypt The following NEW packages will be installed: apache2 apache2-bin apache2-data apache2-utils dbconfig-common dbconfig-mysql javascript-common libapache2-mod-php7.0 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libgd3 libjbig0 libjs-jquery libjs-sphinxdoc libjs-underscore liblua5.2-0 libtiff5 libxpm4 libzip4 php php-bz2 php-common php-curl php-gd php-mbstring php-mysql php-pear php-php-gettext php-phpseclib php-tcpdf php-xml php-zip php7.0 php7.0-bz2 php7.0-cli php7.0-common php7.0-curl php7.0-gd php7.0-json php7.0-mbstring php7.0-mysql php7.0-opcache php7.0-readline php7.0-xml php7.0-zip phpmyadmin ssl-cert 0 upgraded, 49 newly installed, 0 to remove and 6 not upgraded. Need to get 19.2 MB of archives. After this operation, 69.1 MB of additional disk space will be used. Do you want to continue? [Y/n]
중간에 apache2 체크합니다.
YES 하고 넘어갑니다.
비밀번호를 설정하지 않았기 때문에 그냥 넘어갑니다. 소켓으로 연결이 허용된 상태입니다. 이때 mysql_secure_installation 명령을 쓸 수 있지만, 넘어갑니다.
이후 결과 내용입니다.
dbconfig-common: writing config to /etc/dbconfig-common/phpmyadmin.conf Replacing config file /etc/dbconfig-common/phpmyadmin.conf with new version Replacing config file /etc/phpmyadmin/config-db.php with new version checking privileges on database phpmyadmin for phpmyadmin@localhost: user creation needed. granting access to database phpmyadmin for phpmyadmin@localhost: success. verifying access for phpmyadmin@localhost: success. creating database phpmyadmin: success. verifying database phpmyadmin exists: success. populating database via sql... done. dbconfig-common: flushing administrative password Setting up php (1:7.0+49) ... Processing triggers for libc-bin (2.24-11+deb9u4) ... Processing triggers for systemd (215-17+deb8u6) ...
3. phpmyadmin 연동
# apache2.conf 파일을 수정합니다. root@AOL-Debian:~# nano /etc/apache2/apache2.conf # phpmyadmin Include /etc/phpmyadmin/apache.conf
# 서비스를 재시작합니다. root@AOL-Debian:~# service apache2 restart [....] Restarting Apache httpd web server: apache2AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message . ok
# 서버 네임을 모르겠다는 에러를 아래와 같이 해결합니다. root@AOL-Debian:~# nano /etc/apache2/apache2.conf # server name ServerName localhost
# 정상적으로 재시작 됩니다. root@AOL-Debian:~# service apache2 restart [ ok ] Restarting Apache httpd web server: apache2. root@AOL-Debian:~#
4. mariadb db 테이블 변경
초기에 비밀번호를 설정하지 않아서 root 로 로그인이 될것 같지만, 되지 않습니다.
콘솔로 mysql 에 연결합니다.
root@AOL-Debian:~# mysql -u root -p # 비밀번호는 공백입니다. Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 56 Server version: 10.1.26-MariaDB-0+deb9u1 Debian 9.1 Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. # db mysql 을 사용합니다. MariaDB [(none)]> use mysql Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed # user 테이블 root 계정에 대해 plugin 부분을 공백으로 처리합니다. MariaDB [mysql]> update user set plugin='' where user='root'; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 # PASSWORD('') 부분에 원하는 비밀번호를 적으시길 바랍니다. # root 계정에 대해 업데이트 하는 부분입니다. MariaDB [mysql]> update user set password=PASSWORD('djj9405') where user='root'; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 # 권한을 재로딩합니다. MariaDB [mysql]> flush privileges; Query OK, 0 rows affected (0.00 sec) # 연결을 종료합니다. MariaDB [mysql]> exit Bye
http://u5pvr_ip_addr/phpmyadmin 다시 로그인하게 되면 아래와 같이 잘 로그인 됩니다.
보안 관련하여 필요할 경우에만 phpmyadmin 을 열어두시길 바랍니다.
한편, 외부에서 DB 접근을 하는 경우 root 계정은 socket 연결만 허용하시는게 좋습니다.