# Run this line to unistall mysql and install mysql2
npm un mysql && npm i mysql2
# then switch the name of your import in your node file
#const mysql = require("mysql2");
#mysql2 uses the updated form of authentication
# To learn more read this stackoverflow answer: https://stackoverflow.com/a/56509065/13776398
$ mysql -u root -p
Enter password: (enter your password)
mysql> ALTER USER 'root' IDENTIFIED WITH mysql_native_password BY 'PASSWORD';
mysql> FLUSH PRIVILEGES;
mysql> quit
// Run this line to unistall mysql and install mysql2
npm uninstall mysql && npm install mysql2
// Switch the name of your import in your node file
import mysql2 from 'mysql2'
// mysql2 uses the updated form of authentication
/* First run this */
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
/* Where root as your user localhost as your URL and password as your password */
/* Then flush all prvilates */
flush privileges;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password ...