무작정 개발.Vlog

[MariaDB] MariaDB root 계정 비밀번호 설정하기

by 무작정 개발
반응형

이번에는 MariaDB root 계정 비밀번호 설정에 대해 정리할 것이다.

MariaDB가 설치되어 있지 않으면 [MariaDB] MariaDB 설치 - 맥 m1를 참고하면 된다.

MariaDB
MariaDB

나의 환경
OS : macOS Monterey (Apple M1)
터미널 : iterm2

1. MariaDB root 계정 생성

1
sudo mariadb-secure-installation
cs

mariaDB root 계정 생성
mariaDB root 계정 생성

sudo를 통해 진입하면 처음에 나오는 Password는 본인의 맥북 패스워드를 입력한다.

그다음에 나오는 current password는 아직 설정이 안 돼있기에 Enter를 입력하면 넘어간다.

2. MariaDB 세팅

  • 필자가 세팅한 정보를 그대로 복사해서 넣었다. 중간에 패스워드 설정 및 다른 세팅 정보가 있다.
  • 마지막에 [ Thanks for using MariaDB! ]라는 문구가 나오면 성공적으로 세팅이 된 것이다.
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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] n
 ... skipping.
 
You already have your root account protected, so you can safely answer 'n'.
 
Change the 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] n
 ... 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
 - 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!
cs

3. MariaDB root 계정 접속하기

1
mysql -u root -p
cs

위의 명령어를 입력 후 Password를 입력했을 때 하단의 화면이 나오면 성공적으로 root 계정으로 mariaDB 연결 성공!

mariaDB root 계정 비밀번호 변경
mariaDB root 계정 비밀번호 변경

 

반응형

'DataBase > MariaDB' 카테고리의 다른 글

[MariaDB] MariaDB 설치 - 맥북m1  (2) 2022.09.18

블로그의 정보

무작정 개발

무작정 개발

활동하기