일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- fstab
- VMware
- MOUNT
- GlusterFS
- VirtualBox
- AIR
- Trac
- BIND
- Linux
- Fedora
- redmine
- tw_cli
- CentOS
- php5
- Subversion
- ftp
- Network
- nateon
- APM
- MySQL
- 라라벨
- 명령어
- php
- Laravel
- JavaScript
- exception
- xampp
- ubuntu
- vsftpd
- httpd.conf
- Today
- Total
어제와 똑같이 살면서 다른 미래를 기대하지 말자
[CentOS7] MariaDB 설치 10.2.x 본문
1. MariaDB 설치
1) YUM REPO 등록
https://mariadb.com/kb/en/library/mariadb-package-repository-setup-and-usage/
# curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
2) 설치
# yum install mariadb-server
2. MariaDB 실행
# systemctl start mariadb
# systemctl enable mariadb
# 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] y
New password:
Re-enter new password:
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] y
... 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] y
... 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] y
- 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] y
... 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!
4. MariaDB cnf 파일설정
# systemctl stop mariadb
1) 기본 data 디렉토리 변경 시
# mkdir /db/mysql
# chown --reference=/var/lib/mysql /db/mysql && chmod --reference=/var/lib/mysql /db/mysql
or ( chown mysql:mysql -R /db/mysql && chmod 755 /db/mysql )
# mv /var/lib/mysql/* /db/mysql/
# rm -rf /var/lib/mysql
2) server.cnf 설정
# vi /etc/my.cnf.d/server.cnf
#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#
# this is read by the standalone daemon and embedded servers
[server]
# this is only for the mysqld standalone daemon
[mysqld]
datadir=/db/mysql # mysql 기본 data 디렉토리 변경
socket=/db/mysql/mysql.sock # socket 경로 변경
character-set-server=utf8
#
# * Galera-related settings
#
[galera]
# Mandatory settings
#wsrep_on=ON
#wsrep_provider=
#wsrep_cluster_address=
#binlog_format=row
#default_storage_engine=InnoDB
#innodb_autoinc_lock_mode=2
#
# Allow server to accept connections on all interfaces.
#
#bind-address=0.0.0.0
#
# Optional setting
#wsrep_slave_threads=1
#innodb_flush_log_at_trx_commit=0
# this is only for embedded server
[embedded]
# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]
# This group is only read by MariaDB-10.1 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mariadb-10.1]
3) mysql-client.conf 설정
# vi /etc/my.cnf.d/mysql-clients.cnf
#
# These groups are read by MariaDB command-line tools
# Use it for options that affect only one utility
#
[mysql]
default-character-set=utf8
socket=/db/mysql/mysql.sock # 설정하지 않을경우 mysql 접속 시 에러발생
# port=3306 (기본포트 변경 시 사용)
[mysql_upgrade]
[mysqladmin]
[mysqlbinlog]
[mysqlcheck]
[mysqldump]
[mysqlimport]
[mysqlshow]
[mysqlslap]
5. mariadb 접속 및 설정확인
1) 기본 디렉토리 경로설정 확인
MariaDB [(none)]> select @@datadir;
+------------+
| @@datadir |
+------------+
| /db/mysql/ |
+------------+
MariaDB [(none)]> show variables like 'c%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
| check_constraint_checks | ON |
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
| completion_type | NO_CHAIN |
| concurrent_insert | AUTO |
| connect_timeout | 10 |
+--------------------------+----------------------------+
'IT관심분야 > Linux' 카테고리의 다른 글
[CentOS7] 시스템 시간 타임존 변경(timedatectl) (0) | 2018.02.28 |
---|---|
[CentOS7] NFS-SERVER (0) | 2018.02.26 |
[CentOS7] rc.local 부팅 시 실행 (0) | 2018.02.14 |
[CentOS] yum repo 활성/비활성 (yum-config-manager) (0) | 2018.02.02 |
[CentOS] nodejs, npm 설치 (0) | 2018.01.25 |