[AWS-EC2 Hadoop|Hive|Spark] yum으로 MariaDB 10.5 설치
| System Structure
10일째인 오늘은 MariaDB를 설치하겠습니다.
목차
1. MariaDB 설치 및 실행
1.1 MariaDB 패스워드 변경
1.2 MariaDB 접속 및 DB 테스트
내용
1. MariaDB 설치 및 실행
[hadoop@Namenode ~]$ sudo yum install mariadb-server -y
[hadoop@Namenode ~]$ sudo systemctl enable --now mariadb
[hadoop@Namenode ~]$ sudo systemctl status mariadb
1.1 MariaDB 패스워드 변경
[hadoop@Namenode ~]$ sudo 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
haven't set the root password yet, you should just press enter here.
Enter current password for root (enter for none): 현재 root 패스워드
OK, successfully used password, moving on...
Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] Y
Enabled successfully!
Reloading privilege tables..
... Success!
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] Y -- root password 변경할것인지?
New password: 바꾸고 싶은 root패스워드 입력
Re-enter new password: 바꾸고 싶은 root패스워드 한번더 입력
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 -- anonymous users를 지울것인지
... 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] n -- 외부 root 로그인을 허가하지 않을것인가?
... skipping.
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 -- test db를 제거하고 접근하지 않을것인가?
- 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 --권한있는 table을 reload를 할것인가?
... 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!
1.2 MariaDB 접속 및 DB 테스트
[hadoop@Namenode ~]$ mysql -uroot -pmysql
MariaDB [(none)]> create database hivedb;
MariaDB [(none)]> create user hiveuser@localhost identified by 'hivepw';
MariaDB [(none)]> grant all privileges on hivedb.* to hiveuser@localhost;
MariaDB [(none)]> grant all privileges on hivedb.* to hiveuser@'client' identified by 'hivepw';
MariaDB [(none)]> flush privileges;
1.3 MySQL Connector 설치
MySQL과 다른 프로그램을 연결해주기 위하여 MySQL Connetor도 설치합니다.
https://downloads.mysql.com/archives/c-j/
- Product Version: 8.0.21
- Operating System: Red Hat Enterprise Linux / Oracle Linux
- OS version : All 혹은 특정 버전을 선택해도 된다.
Redhat9를 사용하고 있긴한데, Redhat9 버전이 없어서 Redhat 8버전을 설치했는데 잘돌아가는것 같습니다.