mysql报错:1130 -host 'localhost' is not allowed to connect to this mysql server

错误提示:1130 -host ‘localhost’ is not allowed to connect to this mysql server

原因:手贱把mysql数据库系统中mysql数据库给删了

解决办法:

首先关闭mysql服务,
其次打开一个终端输入:mysqld –skip-grant-tables
这里写图片描述
最后再打开一个终端输入:mysqlcheck –check-upgrade –all-databases –auto-repair
这里写图片描述

之后就可以连上数据库了。

注意:

该操作会把存储过程、函数、保存的一些查询代码删掉,被删除的查询语句再重新载入即可,不过表文件是没有问题的。

载入,在新建查询中
这里写图片描述

保存的SQL语句,我的是在:
这里写图片描述

原文地址:https://www.cnblogs.com/tengpengfei/p/10454016.html