【问题标题】:Access denied for user 'user'@'localhost'用户 'user'@'localhost' 的访问被拒绝
【发布时间】:2021-07-11 13:21:05
【问题描述】:
var mysql = require('mysql');

var db = mysql.createConnection({
    host: "localhost",
    user: "John",
    password: "*********"
});

module.exports = db;

【问题讨论】:

    标签: mysql phpmyadmin localhost


    【解决方案1】:

    您需要授予用户John 对您尝试使用的数据库的访问权限:

    mysql> grant all privileges to John@localhost identified by 'your_password';
    mysql> flush privileges;
    

    然后再试一次。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-01-20
      • 2012-08-02
      • 2017-01-27
      • 1970-01-01
      • 1970-01-01
      • 2018-04-26
      • 1970-01-01
      相关资源
      最近更新 更多