본문 바로가기
카테고리 없음

[UBUNTU] 우분투 mysql 설치

by 아이엠제니 2024. 2. 6.

 

 

os: ubuntu 22.04.3 LTS


 

 

1. MySQL 설치

sudo apt update
sudo apt install mysql-server

 

👉 MySQL 상태 확인

sudo systemctl status mysql

 

 

 

2. 계정 생성

1. root 접속

sudo mysql -u root

 

 

2. use mysql

use mysql

 

 

3. 계정 생성

create user 'test'@'%' identified by 'test1234';
  • test: 사용자이름 (username)
  • test1234: 비밀번호 (password)

 

 

4. 권한 부여

grant all privileges on test_db.* to 'test'@'%';
  • test_db: 데이터베이스명 (database)
  • test: 사용자이름 (username)

 

 

5. 생성한 계정 확인하는 방법

SELECT user, host, authentication_string, plugin FROM mysql.user;

 

 

 

300x250