连接数据库提示Host 'localhost' is not allowed to connect to this MySQL server解决办法

在连接本地数据库出现Host 'localhost' is not allowed to connect to this MySQL server错误的解决办法:

1:关闭mysql服务

连接数据库提示Host 'localhost' is not allowed to connect to this MySQL server解决办法_第1张图片

2:打开CMD窗口,进入mysql安装目录下的bin目录,输入:

mysqld --skip-grant-tables

然后回车

连接数据库提示Host 'localhost' is not allowed to connect to this MySQL server解决办法_第2张图片

3:再打开一个CMD窗口,进入mysql安装目录下的bin目录,输入:

mysql -u root -p

回车

4:输入密码,回车(此密码是mysql的新密码)

连接数据库提示Host 'localhost' is not allowed to connect to this MySQL server解决办法_第3张图片

5:即可正常连接mysql

你可能感兴趣的:(mysql,mysql)