npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@jhb0430/mysql

v0.1.2

Published

database.yml 에 적은 MySQL 접속 정보로 풀과 connection URL을 만든다. 스키마는 포함하지 않는다.

Readme

@jhb0430/mysql

MySQL 접속 정보를 프로젝트의 database.yml에 한 번 적으면, 그다음부터는 그 파일로 풀과 접속 URL을 만듭니다. 비밀번호는 패키지에 들어 있지 않고, 이 파일에만 있습니다. 테이블 스키마는 포함하지 않습니다.

설치

npm install @jhb0430/mysql mysql2

설정 파일

프로젝트 루트에서 한 번 실행합니다.

npx @jhb0430/mysql init

database.yml이 없으면 아래 내용으로 만듭니다. 이미 있으면 덮어쓰지 않습니다.

host: localhost
port: 3306
username:
password:
database:

host와 port는 기본값입니다. 내 컴퓨터의 MySQL이면 보통 그대로 둡니다. username, password, database는 그 MySQL을 만들 때 정한 값으로 채웁니다. database는 MySQL 안에 미리 만들어 둔 데이터베이스 이름입니다.

상위 폴더에 database.yml이 있으면 그 파일 하나를 사용합니다. 같은 프로젝트를 위해 파일을 또 만들지 않습니다.

사용

const { createMysqlPool, toDatabaseUrl } = require('@jhb0430/mysql')

const pool = createMysqlPool()
const url = toDatabaseUrl()

인자를 넘기지 않으면 database.yml을 읽습니다. 이미 설정 객체가 있으면 그대로 넘길 수 있습니다.

const { createMysqlPool } = require('@jhb0430/mysql')

const pool = createMysqlPool({
  host: 'localhost',
  port: 3306,
  username: 'root',
  password: 'secret',
  database: 'practice',
})

username은 mysql2 옵션의 user가 됩니다. 풀은 대기 연결과 크기 10을 기본으로 합니다. toDatabaseUrl은 mysql://사용자:비밀번호@호스트:포트/데이터베이스 형식입니다.

database.yml에는 비밀번호가 들어가므로 Git에 올리지 않습니다.