nodejs连接mysql报错:throw err; // Rethrow non-MySQL errors TypeError: Cannot read property 'query' of undefined
该问题的解决方案如下:
- win+R 输入cmd
- mysql -u root -p 输入密码进入到mysql
3.执行sql语句,将密码改成123456(自己可以记住的密码即可)
alter user 'root'@'localhost' identified with mysql_native_password by '123456';
4.再执行sql语句
flush privileges;
5.然后退出数据库
6.重新启动node服务
只要思想不滑坡,办法总比困难多!