Notice
Recent Posts
Recent Comments
Link
«   2024/07   »
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
Tags
more
Archives
Today
Total
관리 메뉴

개발공부일지

Database - sql 계정 생성, mysql2 설치, net-tools설치 본문

DataBase

Database - sql 계정 생성, mysql2 설치, net-tools설치

보람- 2023. 9. 20. 17:38

목차

1. sql 계정 생성하기

2. net-tools 설치하기

3. mysql2 설치하기


 

 

1. sql 계정 생성하기

use mysql;
select user,host from user;
mysql> select user,host from user;
+------------------+-----------+
| user             | host      |
+------------------+-----------+
| debian-sys-maint | localhost |
| mysql.infoschema | localhost |
| mysql.session    | localhost |
| mysql.sys        | localhost |
| root             | localhost |
+------------------+-----------+
create user '[유저네임]'@'%' identified with mysql_native_password by '[비밀번호]';
create user 'boram'@'%' identified with mysql_native_password by '---------';
FLUSH PRIVILEGES;
mysql> select user,host from user;
+------------------+-----------+
| user             | host      |
+------------------+-----------+
| boram            | %         |
| debian-sys-maint | localhost |
| mysql.infoschema | localhost |
| mysql.session    | localhost |
| mysql.sys        | localhost |
| root             | localhost |
+------------------+-----------+

 

- 계정을 생성해준다음에 root 계정으로 들어가서 생성한 계정에 권한주기

grant all privileges on *.* to '[유저네임]'@'%' with grant option;
grant all privileges on *.* to 'boram'@'%' with grant option;

 

-  mysql접속해보기

sudo service mysql restart
sudo mysql -uboram -p
# 비밀번호 입력

 

 

 

2. net-tools 설치하기

sudo apt install net-tools

sudo netstat -ntlp | grep mysqld
# tcp   0   0 127.0.0.1:33060   0.0.0.0:*    LISTEN      1313/mysqld
# tcp   0   0 127.0.0.1:3306    0.0.0.0:*    LISTEN      1313/mysqld


cd /etc/mysql/mysql.conf.d

sudo vi mysqld.cnf

- mysqld.cnf 에서 기존의 bind-address 주석처리하고 bind-address = 0.0.0.0 입력하고 저장해주기

- 그리고 다시 mysql restart 해보기

 

 

 

3. mysql2 설치하기

npm init -y
npm install mysql2

 

 

 


 

'DataBase' 카테고리의 다른 글

Database - Database connection  (0) 2023.09.20
Database - SQL, DDL, DML  (0) 2023.09.19
Database - MySQL , DBMS, RDBMS  (0) 2023.09.18