Linux 中mysql8 执行sql脚本出现 Error Code 1044 - Access denied for user root to database information_schema 怎么解决
这个错误是因为MySQL用户'root'@'%'没有访问数据库'information_schema'的权限。'information_schema'是MySQL系统数据库,存储有关数据库和表的元数据信息。
要解决这个问题,你可以尝试以下几种方法:
-
授予用户'root'@'%'访问'information_schema'数据库的权限。在MySQL命令行中执行以下命令:
GRANT ALL PRIVILEGES ON `information_schema`.* TO 'root'@'%'; FLUSH PRIVILEGES; -
如果你不需要在SQL脚本中操作'information_schema'数据库,可以在执行脚本时使用
--skip-information-schema参数来跳过该数据库:mysql -u root -p --skip-information-schema < your_script.sql -
检查你的SQL脚本,确保没有试图在'information_schema'数据库中执行操作。
请注意,直接将MySQL的root用户暴露在公共网络中是不安全的,建议使用更安全的方式连接数据库
原文地址: http://www.cveoy.top/t/topic/iz2o 著作权归作者所有。请勿转载和采集!