본문 바로가기
공부/Trouble Shooting

윈도우에서 우분투 ssh로 원격접속 후 mariaDB 설치

by son_i 2023. 8. 24.
728x90

(윈도우에서 우분투 원격접속 후 ssh ubuntu@탄력IP 윈도우 cmd에서 진행 중)

파일로 받지 않고 Server Repositories에서 받는 작업 진행

세 줄 명령어를 다 치고 나서 

$ apt search mariadb-server 

하니까 설치한 10.6이 안 나오고 10.3 밖에 없었다.

강사님이 다운 받은 명령어가 좀 씩 달라서 나는 아래 명령어까지 수행했다.

sudo apt-get update 까지 하고 $ apt search mariadb-server 

하니까

10.6이 생겼다 !! ><

 

sudo apt-get install mariadb-server

이거까지 해주면 mariadb 10.6 설치 완료 !

 

와중에 한국어 설정

https://ti.bqbro.com/21

 

[Linux] 우분투 터미널 한글 적용

기본 우분투의 터미널에선 한글 입력이 안된다. 단순 한글 입력을 못한다를 넘어서서한글 출력 또한 안되기 때문에 한글이 들어간 소스 코드의 실행에 오류가 나는 경우가 생긴다.이 문제를 해

ti.bqbro.com

여기 참고

 

db 서버 설치하고 초기화 필수

root 계정으로 

# find / -name mariadb-secure* //이 명령어 쳐서
/usr/bin/mariadb-secure-installation // 이 파일 찾음

 

# mariadb-secure-installation //요렇게 실행 아래 Y / n 설

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):
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] n
 ... skipping.

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!

 

-------------------------------

우분투 서버에 원격접속해서 설치를 하고 있기 때문에 우분투 입장에서 데이터베이스 접근하는 건 로컬임.

 

# service mariadb start

# ps -ef | grep mariadb   //서비스 올라갔는지 확인

# netstat -anpt //포트를 통해 올라갔는지 확인

서비스 잘 되고 있는 거 확인 했으니 exit로 루트계정 빠져나옴

 


우분투 DB 접근 - mysql 명령어 통해

$ mysql -u root -p

(로컬로 접속했기 때문에 host를 써주지 않아도 됨)