NodeJS/mySQL - ER_ACCESS_DENIED_ERROR Access denied for user 'root'@'localhost' (using password: YES)
Using recent MySQL version in package.json solved the problem.
I was using version 2.0.0. I changed the version to 2.10.2.
ER_ACCESS_DENIED_ERROR: Access denied for user ''@'localhost' (using password: NO)
You must create a MySQL user specifically to access the app. Create a user and set a password (do not leave the password null). Do not forget to give this user permission to be able to access the database and tables of app. I hope I have helped.
nodejs express reconnect mysql ER_ACCESS_DENIED_ERROR: Access denied for user ''@'localhost' (using password: NO)
var mysql = require('mysql')
var connection = mysql.createPool({
host: "localhost",
user: "root",
password: "",
database: "dbname",
port : "3306"
})
connection.getConnection((err, connection) => {
if (err) {
if (err.code === 'PROTOCOL_CONNECTION_LOST') {
console.error('Database connection was closed.')
}
if (err.code === 'ER_CON_COUNT_ERROR') {
console.error('Database has too many connections.')
}
if (err.code === 'ECONNREFUSED') {
console.error('Database connection was refused.')
}
}
if (connection) connection.release()
return
})
module.exports = connection
example : https://github.com/vishalims095/nodeJS_Mysql/blob/developer/src/Modules/connection.js
NodeJS/mySQL - ER_ACCESS_DENIED_ERROR Access denied for user 'root'@'localhost' (using password: YES)
Using recent MySQL version in package.json solved the problem.
I was using version 2.0.0. I changed the version to 2.10.2.
Directus ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost' (using password: YES)
To change the default user password you will need to edit the config.inc.php
file located in XAMMP/phpmyadmin/config.inc.php
From
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
To
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'root';
Before you save the file, you will need update the password for root@localhost
Related Topics
Sql: Update Column With Increment Numbers Based on 2 Columns
Storing Image in Database Directly or as Base64 Data
Make SQL Select Same Row Multiple Times
Disable Secure Priv for Data Loading on MySQL
Mysql Table Insert If Not Exist Otherwise Update
Is There a Command to Test an SQL Query Without Executing It ( MySQL or Ansi SQL )
How to Extract Part of a String in Hive
Check If a Row Exists, Otherwise Insert
How to Calculate Difference of Values in a Successive Rows
How to Strip All Non-Alphabetic Characters from String in SQL Server
How to Use SQL Like Condition With Multiple Values in Postgresql
Sqlcmd Not Able to Find a Library (Libmsodbcsql-17.0.So.1.1) That Is There
How to Subtract One Month from a Date Column
Phone Number Display Method, SQL Query
Combining (Concatenating) Date and Time into a Datetime
Query to Calculate Average of Employee Salaries Working Under Manager in SQL
List All Employee'S Names and Their Managers by Manager Name Using an Inner Join
Sql Server How to Find the Customers Who Have Bought a Product from Each Store