-
[MySQL] mySQL과 express 서버 연동하기memoir 2021. 12. 9. 19:33
https://poiemaweb.com/nodejs-mysql
MySQL 연동 | PoiemaWeb
Node.js(express)와 MySQL 연동
poiemaweb.com
기존 코드에서 추가한 코드
const connection = mysql.createConnection({ host : 'localhost', user: 'root', password: 'sql에서 설정한 비밀번호', database : 'sql에서 설정한 스키마' }); connection.connect(); //user는 테이블 이름 connection.query('SELECT * from user',(error,rows,fields)=>{ if(error) throw error; console.log('User info is', rows); }); connection.end();
'memoir' 카테고리의 다른 글
파이프라인 (0) 2022.02.13 리액트 개발환경 세팅 (0) 2022.02.02 폴더구조 그리는 cmd 명령어 tree (0) 2021.11.30 깃헙 리드미 쓸 때 참고할 마크다운 (0) 2021.11.25 일주일마다 까먹는 github 사용방법 (0) 2021.11.16