[리눅스] MySQL 최초 접속 및 설정

MySQL 설치 및 보안 설정이 완료되면 다음의 명령어로 MySQL 을 접속하실 수 있습니다.

mysql -u root -p
root@dothome-world ~]# mysql -u root -p Enter password: # 설정하신 암호를 넣어주시면 되며, 보안으로 인해 입력된 단어는 화면에 표시되지 않음 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 22 Server version: 5.7.26 MySQL Community Server (GPL) Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>

이로써 MySQL 설치가 완료되었습니다. MySQL 계정 생성 및 데이터 베이스 생성 방법을 알려드리고 글을 마무리하겠습니다.

데이터 베이스 생성

create database <DB 이름>;
mysql> create database dot_world; Query OK, 1 row affected (0.01 sec)

계정 생성

create user <계정 이름>@localhost identified by '<계정 암호>';
mysql> create user dot_world@localhost identified by '%DOT_world2@198273'; Query OK, 0 rows affected (0.00 sec)

데이터베이스에 localhost 로 계정 권한 부여

grant all on <DB 이름>.* to <계정 이름>@'localhost';
mysql> grant all on dotworld.* to dot_world@'localhost'; Query OK, 0 rows affected (0.00 sec)

Tip.

외부에서 MySQL 서버로 계정 접근을 하시는 경우 IP을 열어줘야 합니다.

grant 문에서 localhost 부분에서 접근하는 IP를 열어주시면 됩니다.

예로 들어 192.168.10.10 IP가 MySQL 서버의 dot_world 계정으로 접근한다면 다음과 같이하면 됩니다.

grant all on dotworld.* to dot_world@'192.168.10.10';

(만약, 192.168.10.0/24 IP 대역에서 접근 시 % 기호를 이용하시면 됩니다. 예 : '192.168.10.%'

grant 권한 재설정

flush privileges;
mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)

0
0
이 글을 페이스북으로 퍼가기 이 글을 트위터로 퍼가기 이 글을 카카오스토리로 퍼가기 이 글을 밴드로 퍼가기
captcha
자동등록방지 숫자입력

웹개발

번호 제목 글쓴이 날짜 조회수
2 HTML 특수문자 리스트 최고관리자 08-08 1,362
1 유니코드 특수문자 리스트 최고관리자 08-08 1,412