データベース接続ノードのMySQL

CONSTのMySQL =(必要' のMySQL ' CONST CON = mysql.createConnection({
    ホスト:' localhostの' 
    ユーザー:ルート
    パスワード:' ****** ' 
    ポート:' 3306 ' 
    データベース:' myblog '
})

con.connect()

constの SQL = " ユーザーから*選択します。' 
con.query(SQL、(ERR、結果) => {
     場合(ERR){
        console.error(ERR)
        リターン
    }
    console.log(結果)
})
con.end()

おすすめ

転載: www.cnblogs.com/hack-ing/p/12027391.html