반응형

MariaDB는 mysql 의 Clone DB로 mysql과 거의 동일하다 10.3.x 버전부터는 Mysql과 다른 길을 걷고 있기 때문에 10.3.x 버전부터는 적용시 검토가 필요하다.

여기서는 stable 버전중에 mysql 5.7과 호환이 가능한 10.2.26 버전을 설치해본다.

 

1,.파일다운로드 페이지

https://downloads.mariadb.org/mariadb/10.2.26/

 

2. 설치 파일 선택(현재 OS는 CentOS 6.10)


mariadb-10.2.26-linux-systemd-x86_64.tar.gz -> CentOS 7 이상 설치x

mariadb-10.2.26-linux-glibc_214-x86_64.tar.gz (requires GLIBC_2.14+)

 [mysql@test-db ~]$ getconf -a | grep libc
GNU_LIBC_VERSION                   glibc 2.12


--> 2.14보다 아래라서 설치x


mariadb-10.2.26-linux-x86_64.tar.gz --> 설치가능O

 

3. Mariadb-10.2.26 설치

-- 초기설정은 Mysql 5.7과 같다 다른부분만 기술한다.

 #권한su

[root@testdb]# /home/mysql/mariadb/bin/mysql_install_db --user=mysql --defaults-file=/etc/my.cnf --basedir=/home/mysql/mariadb --datadir=/home/mysql/mariadb_data

 

#Trouble shooting 1) 뭐냐 왜 안돼냐..my.cnf 돌려쓰기 실패..
# /data/svc/mariadb/bin/mysql_install_db --user=mysql --defaults-file=/etc/my.cnf --basedir=/data/svc/mariadb --datadir=/data/svc/mariadb_data
Installing MariaDB/MySQL system tables in '/data/svc/mariadb_data' ...
2018-05-14 14:44:21 140143191357216 [Warning] 'THREAD_CONCURRENCY' is deprecated and will be removed in a future release.
2018-05-14 14:44:22 140143191357216 [ERROR] /data/svc/mariadb/bin/mysqld: unknown variable 'innodb_additional_mem_pool_size=32M'
2018-05-14 14:44:22 140143191357216 [ERROR] Aborting
# => innodb_additional_mem_pool_size 주석처리함
#확인: innodb_additional_mem_pool_size was deprecated and has been removed, but innodb_file_format etc
https://mariadb.com/kb/en/library/changes-improvements-in-mariadb-102/

By default, until MariaDB 10.1, MariaDB uses the XtraDB storage engine, a performance enhanced fork of the InnoDB storage engine. For compatibility reasons, the system variables still retain their original innodb prefixes, and where the text in this knowledge base refers to InnoDB, it can usually be understood as referring to the XtraDB fork.
From MariaDB 10.2, InnoDB is the default (see Why MariaDB uses InnoDB instead of XtraDB from MariaDB 10.2).
Note that it is possible to use InnoDB as a plugin in MariaDB 10.1 and before instead of XtraDB. See Using InnoDB instead of XtraDB.
=> 10.2.x 버전부터 MariaDB도 XtraDB가 아니라 innodb를 default로 사용한다.

 

#my.cnf 수정후 다시 설치해본다.

[root@testdb]# ./mysql_install_db --user=mysql --defaults-file=/etc/my.cnf --basedir=/home/mysql/mariadb --datadir=/home/mysql/mariadb_data

 

Installing MariaDB/MySQL system tables in '/data/svc/mariadb_data' ...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:

'/data/svc/mariadb/bin/mysqladmin' -u root password 'new-password'
'/data/svc/mariadb/bin/mysqladmin' -u root -h 172.31.8.62 password 'new-password'

Alternatively you can run:
'/data/svc/mariadb/bin/mysql_secure_installation'

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.

You can start the MariaDB daemon with:
cd '/data/svc/mariadb' ; /data/svc/mariadb/bin/mysqld_safe --datadir='/data/svc/mariadb_data'

You can test the MariaDB daemon with mysql-test-run.pl
cd '/data/svc/mariadb/mysql-test' ; perl mysql-test-run.pl

Please report any problems at http://mariadb.org/jira

The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Consider joining MariaDB's strong and vibrant community':
https://mariadb.org/get-involved/

 

[root@testdb]#

# 잘된다ㅎㅎ

 

#시작 스크립트 작성
ln -s /home/mysql/mariadb/support-files/mysql.server /home/mysql/mariadb/bin/
ln -s /home/mysql/mariadb/bin/mysql.server /etc/init.d/mysqld

 

[root@testdb]# service mysqld start

Starting MariaDB.180521 16:16:34 mysqld_safe Logging to '/home/mysql/mariadb_logs/error/mysql.err'.
180521 16:16:34 mysqld_safe Starting mysqld daemon with databases from /home/mysql/mariadb_data
..                                                         [  OK  ]

 

#보안설정

[root@testdb]# cd /home/mysql/mariadb/bin

[root@testdb]# ./mysql_secure_installation --basedir=/home/mysql/mariadb

 

print: /home/mysql/mariadb/bin/my_print_defaults

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):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
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!

 

[root@testdb]# cd /home/mysql/mariadb/bin
[root@testdb]# cp my_print_defaults mysql mysql_config mysqladmin mysqlbinlog mysqlcheck mysqldump mysqlimport mysqlshow mysqlslap /usr/bin
[root@bin]# chown -Rf root.root my_print_defaults mysql mysql_config mysqladmin mysqlbinlog mysqlcheck mysqldump mysqlimport mysqlshow mysqlslap

 

[root@testdb]# service mysqld stop

 

#mysql 계정으로 접속

[mysql@testdb]# service mysqld start

 

#쉘 접속확인

[mysql@testdb]# mysql -uroot -p

 

 

 

반응형
블로그 이미지

dung beetle

취미는 데이터 수집 직업은 MYSQL과 함께 일하는 DBA의 소소한 일상 이야기

,