ubuntu - mysql connect

BackEnd_Ash.log·2021년 7월 26일
0

node

목록 보기
8/9

we use rds when we use AWS cloud .

but we also can use install mysql on ec2

📌 install

sudo apt-get update
sudo apt-get install -y mysql-server

so mysql 5.7 is installed.

if you want mysql version 8.0 👇

👉 mysql version 8.0

wget -c https://repo.mysql.com//mysql-apt-config_0.8.13-1_all.deb

sudo dpkg -i mysql-apt-config_0.8.13-1_all.deb

and you write down command sudo apt-get update

sudo apt-get install mysql-server

mysql_secure_installation

you have to set your mysql password

📌 node - mysql connect

https://stackoverflow.com/questions/50093144/mysql-8-0-client-does-not-support-authentication-protocol-requested-by-server

👉 fist method

if you want to get rid of the error , at the cost of risking the security of the project

alter user 'root'@'localhost' identified with mysql_native_password by 'password';
flush privilegs;

👉second method

if you want to have a fix for it , without knowing why , just install and use mysql2
(instead of mysql) and use it

npm install mysql2
mysql = require('mysql2');

profile
꾸준함이란 ... ?

0개의 댓글