亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript - Access denied for user 'root'@'localhost' (using password: YES)
學(xué)習(xí)ing
學(xué)習(xí)ing 2017-06-12 09:20:35
0
3
1117

The mysql connection is successful through the terminal in mac
The connection is successful through the graphical tool Navicat

Failed to connect to mysql through nodejs

Code:

function query(sql, params, callback) {
  var op = {
    host: '127.0.0.1',
    port: '3306',
    user: 'root',
    password: '111111',
    database: 'anjiecc'
  };
  var client = mysql.createConnection(op);
  client.query(sql, function(err, data) {
    if (err) {
      console.log(err);
    } else {
      //調(diào)用dao回調(diào)函數(shù)
      callback(data);
    }
  });
  client.end();
}

Connection error
Access denied for user 'root'@'localhost' (using password: YES)
code: 'ER_ACCESS_DENIED_ERROR',
errno: 1045,
sqlState: '28000'

Please ask God for guidance, thank you!

學(xué)習(xí)ing
學(xué)習(xí)ing

reply all(3)
黃舟

The account you are using does not have permission to log in to the database..
Try to authorize both localhost and 127.0.0.1 respectively

僅有的幸福

Make sure your username and password are not entered incorrectly.
Please confirm whether you have access rights. For details, please refer to the next article: https://faceghost.com/article...

學(xué)霸

grant all privileges on . to 'root'@'localhost' identified by 'your password' with grant option;

flush privileges;

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template