NodeJS连接MySQL 8.4报错:code: 'ER_TABLEACCESS_DENIED_ERROR'
{
code: 'ER_TABLEACCESS_DENIED_ERROR',
errno: 1142,
sqlMessage: "SELECT command denied to user '用户名'@'localhost' for table '表名'",
sqlState: '42000',
index: 0,
sql: 'SELECT * FROM 表名WHERE 属性 = 1 order by id desc'
}
是因为访问数据库的用户没有获得相应权限
use mysql;
select * from user where user='用户名';
如图:
可以看到很多权限是N,只有Y是授予权限了。
解决:
GRANT SELECT,INSERT,DELETE,UPDATE ON 我的数据库名.* TO '用户名'@'localhost';
flush privileges;
MySQL 8.4修改user的host属性值-CSDN博客文章浏览阅读515次,点赞23次,收藏22次。先下载mysql的zip压缩包:MySQL :: Download MySQL Community Serverhttps://dev.mysql.com/downloads/mysql/下载解压后,配置my.ini文件,放到mysql的程序目录里面,my.ini文件:[mysqld]port=3306basedir=D:\mysql\mysql-8.0.27-winx64datadir=D:\mysql\data[client] port=3306default-character-s_数据库环境配置。https://blog.csdn.net/zhangphil/article/details/142698602nodejs连接mysql 8.4报错:Client does not support authentication protocol requested by server_node mysql client does not support authentication -CSDN博客文章浏览阅读871次,点赞12次,收藏12次。先下载mysql的zip压缩包:MySQL :: Download MySQL Community Serverhttps://dev.mysql.com/downloads/mysql/下载解压后,配置my.ini文件,放到mysql的程序目录里面,my.ini文件:[mysqld]port=3306basedir=D:\mysql\mysql-8.0.27-winx64datadir=D:\mysql\data[client] port=3306default-character-s_数据库环境配置。_node mysql client does not support authentication protocol requested by servhttps://zhangphil.blog.csdn.net/article/details/142698252
mysql数据库环境配置和安装启动,Windows-CSDN博客文章浏览阅读930次。先下载mysql的zip压缩包:MySQL :: Download MySQL Community Serverhttps://dev.mysql.com/downloads/mysql/下载解压后,配置my.ini文件,放到mysql的程序目录里面,my.ini文件:[mysqld]port=3306basedir=D:\mysql\mysql-8.0.27-winx64datadir=D:\mysql\data[client] port=3306default-character-s_数据库环境配置https://zhangphil.blog.csdn.net/article/details/122414377