[root@localhost ~]# yum install mariadb
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.oasis.onnetcorp.com
* extras: mirror.oasis.onnetcorp.com
* updates: mirror.oasis.onnetcorp.com
Resolving Dependencies
--> Running transaction check
---> Package mariadb.x86_64 1:5.5.41-2.el7_0 will be updated
--> Processing Dependency: mariadb(x86-64) = 1:5.5.41-2.el7_0 for package: 1:mariadb-server-5.5.41-2.el7_0.x86_64
......
============================================================================================================================
Package Arch Version Repository Size
============================================================================================================================
Updating:
mariadb x86_64 1:5.5.50-1.el7_2 updates 8.9 M
Updating for dependencies:
mariadb-libs x86_64 1:5.5.50-1.el7_2 updates 755 k
mariadb-server x86_64 1:5.5.50-1.el7_2 updates 11 M
Transaction Summary
============================================================================================================================
Upgrade 1 Package (+2 Dependent packages)
Total size: 20 M
Is this ok [y/d/N]:
......
Transaction test succeeded
Running transaction
Updating : 1:mariadb-libs-5.5.50-1.el7_2.x86_64 1/6
Updating : 1:mariadb-5.5.50-1.el7_2.x86_64 2/6
Updating : 1:mariadb-server-5.5.50-1.el7_2.x86_64 3/6
Cleanup : 1:mariadb-server-5.5.41-2.el7_0.x86_64 4/6
Cleanup : 1:mariadb-5.5.41-2.el7_0.x86_64 5/6
Cleanup : 1:mariadb-libs-5.5.41-2.el7_0.x86_64 6/6
Verifying : 1:mariadb-server-5.5.50-1.el7_2.x86_64 1/6
Verifying : 1:mariadb-libs-5.5.50-1.el7_2.x86_64 2/6
Verifying : 1:mariadb-5.5.50-1.el7_2.x86_64 3/6
Verifying : 1:mariadb-5.5.41-2.el7_0.x86_64 4/6
Verifying : 1:mariadb-server-5.5.41-2.el7_0.x86_64 5/6
Verifying : 1:mariadb-libs-5.5.41-2.el7_0.x86_64 6/6
Updated:
mariadb.x86_64 1:5.5.50-1.el7_2
Dependency Updated:
mariadb-libs.x86_64 1:5.5.50-1.el7_2 mariadb-server.x86_64 1:5.5.50-1.el7_2
Complete!
[root@localhost ~]#
|
환경설정 파일을 복사 해 온다. (자신의 서버에 맞는 걸로...)
[root@localhost ~]# cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
cp: overwrite `/etc/my.cnf'? y
[root@localhost ~]#
|
언어 설정 부분을 아래와 같이 2라인을 추가한다.
[root@localhost ~]# vi /etc/my.cnf
# Example MariaDB config file for medium systems.
#
.....
[mysqld]
# 여기 언어 설정 부분을 추가한다.
character-set-server=utf8
collation-server=utf8_general_ci
port = 3306
socket = /var/lib/mysql/mysql.sock
skip-external-locking
......
|
mariadb 서버를 시작한다.
[root@localhost ~]# service mariadb start
Redirecting to /bin/systemctl start mariadb.service
[root@localhost ~]#
|
mariadb 의 root 패스워드를 변경한다.
[root@localhost ~]# mysqladmin password
New password:
Confirm new password:
[root@localhost ~]#
|
테스트를 위해 새로운 DB와 사용자를 추가하고 원격 또는 로컬에서도 접속이 가능하도록 해보자.
[root@localhost ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 5.5.50-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database test_db; <= test_db 생성
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> create user 'binrang'@'%' identified by '******'; <= binrang이라는 사용자와 **** 암호를 %(원격에서도 가능하도록) 설정
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> create user 'binrang'@'localhost' identified by '******'; <= binrang이라는 사용자와 **** 암호를 localhost(로컬에서 가능하도록) 설정
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges; <= 위 명령을 반영하여 재시작
Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]> grant all privileges on test_db.* to 'binrang'@'%'; <= test_db에 binrang 유저를 매칭하고 원격에서 접속하도록 권한 부여
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all privileges on test_db.* to 'binrang'@'localhost'; <= test_db에 binrang 유저를 매칭하고 로컬에서 접속하도록 권한 부여
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
Bye |
이제 서비스에 등록해보자.
[root@localhost ~]# systemctl enable mariadb.service
ln -s '/usr/lib/systemd/system/mariadb.service' '/etc/systemd/system/multi-user.target.wants/mariadb.service'
[root@localhost ~]#
|
서비스를 재시작해보자.
[root@localhost ~]# service mariadb restart
Redirecting to /bin/systemctl restart mariadb.service
[root@localhost ~]#
|
이제 만들어 놓은 DB에 접속을 해 보자.
[root@localhost ~]# mysql -ubinrang -p test_db
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.50-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [test_db]> show tables;
Empty set (0.00 sec)
MariaDB [test_db]>
|
댓글 없음:
댓글 쓰기