Host "localhost " is not allowed to connect to mysql server解决方法
2015-04-17 23:47
507 查看
一、原因:
把MySQL的密码也改成'YES',就连不上了。密码设置时不能使用明文
USE mysql
UPDATE uesr SET password='YES' where user='root' AND host='localhost';
FLUSH PRIVILEGES;
退出控制台后就再进不去了。
mysql -u root -p
mysql -h localhost -u root -p
都不行,出现错误:
"Host 'localhost' is not allowed to connect to this MySQL server."
二、方法
首先停止mysql服务:
sc stop mysql
然后:
mysqld --skip-grant-tables
另开一个终端,继续
mysqlcheck --check-upgrade --all-databases --auto-repair
然后再输入
mysql
就可以进入MySQL控制台了。这样进去以后使用SELECT语句会发现密码使用的是明文:'YES',哈哈,我真是个疯子。
三、问题
以上进去控制台后并不能执行账户维护工作。正确的方法为:
如上进入控制台后,选中要操作的数据库:
4000
use mysql;
然后使用以下语句将密码还原为 root 的 HASH 值:
UPDATE user SET password=PASSWORD('YES') where user='root' AND host='localhost';
然后,mysqld --skip-grant-tables 这个命令似乎只可以在本地运行。
如果mysql服务无法正常停止,使用命令:mysqladmin -u root shutdown
把MySQL的密码也改成'YES',就连不上了。密码设置时不能使用明文
USE mysql
UPDATE uesr SET password='YES' where user='root' AND host='localhost';
FLUSH PRIVILEGES;
退出控制台后就再进不去了。
mysql -u root -p
mysql -h localhost -u root -p
都不行,出现错误:
"Host 'localhost' is not allowed to connect to this MySQL server."
二、方法
首先停止mysql服务:
sc stop mysql
然后:
mysqld --skip-grant-tables
另开一个终端,继续
mysqlcheck --check-upgrade --all-databases --auto-repair
然后再输入
mysql
就可以进入MySQL控制台了。这样进去以后使用SELECT语句会发现密码使用的是明文:'YES',哈哈,我真是个疯子。
三、问题
以上进去控制台后并不能执行账户维护工作。正确的方法为:
如上进入控制台后,选中要操作的数据库:
4000
use mysql;
然后使用以下语句将密码还原为 root 的 HASH 值:
UPDATE user SET password=PASSWORD('YES') where user='root' AND host='localhost';
然后,mysqld --skip-grant-tables 这个命令似乎只可以在本地运行。
如果mysql服务无法正常停止,使用命令:mysqladmin -u root shutdown
相关文章推荐
- Host "localhost " is not allowed to connect to mysql server解决方法
- "Host 'localhost' is not allowed to connect to this MySQL server" 的原因及解决办法
- "Host 'localhost' is not allowed to connect to this MySQL server" 的原因及解决办法
- "Host 'localhost' is not allowed to connect to this MySQL server" 的原因及解决办法
- MySQL连接登陆数据库错误:Host 'localhost' is not allowed to connect to this MySQL server.解决方法
- mysql 远程访问不行解决方法 Host is not allowed to connect to this MySQL server
- 解决1130 Host 'localhost' is not allowed to connect to this MySQL server
- Host is not allowed to connect to this MySQL server解决方法
- Host is not allowed to connect to this MySQL server解决方法
- message from server: "Host is not allowed to connect to this MySQL server"解决办法
- Mariadb-Host '192.168.*.*' is not allowed to connect to this MariaDB server"的解决方法
- mysql 远程访问不行解决方法 Host is not allowed to connect to this MySQL server
- Host is not allowed to connect to this MySQL server解决方法
- Host is not allowed to connect to this MySQL server解决方法
- 解决ERROR 1130: Host '192.168.1.3' is not allowed to connect to this MySQL server 方法
- Host is not allowed to connect to this MySQL server解决方法
- Host is not allowed to connect to this MySQL server解决方法
- 两台电脑,不同网段,互相连接数据库Host is not allowed to connect to this MySQL server解决方法
- mysql远程连接报错: Host * is not allowed to connect to this MySQL server,解决方法
- Host is not allowed to connect to this MySQL server解决方法