在这篇文章中,我们将为您详细介绍Host''localhost''isnotallowedtoconnecttothisMySQLserver的内容。此外,我们还会涉及一些关于1130-Host''1
在这篇文章中,我们将为您详细介绍Host ''localhost'' is not allowed to connect to this MySQL server的内容。此外,我们还会涉及一些关于1130 - Host ''119.137.52.50'' is not allowed to connect to this MySQL server、1130 -host ''localhost'' is not allowed to connect t、ERROR 1130 (HY000): Host ''test177'' is not allowed to connect to this MySQL server、Host ''DESKTOP-QGO5EVD'' is not allowed to connect to this MySQL server的知识,以帮助您更全面地了解这个主题。
本文目录一览:- Host ''localhost'' is not allowed to connect to this MySQL server
- 1130 - Host ''119.137.52.50'' is not allowed to connect to this MySQL server
- 1130 -host ''localhost'' is not allowed to connect t
- ERROR 1130 (HY000): Host ''test177'' is not allowed to connect to this MySQL server
- Host ''DESKTOP-QGO5EVD'' is not allowed to connect to this MySQL server
Host ''localhost'' is not allowed to connect to this MySQL server
修改mysql的root密码后,出现Host ''localhost'' is not allowed to connect to this MySQL server 错误。
解决办法:
C:\Program Files\MySQL\MySQL Server 5.5\my.ini
在[mysqld]下加下面两行,
skip-name-resolve
skip-grant-tables
重启mysql的windows服务,在mysql命令行界面输入
grant all on *.* to ‘admin’@’%’ identified by ‘123’ with grant option;
flush privileges;
1130 - Host ''119.137.52.50'' is not allowed to connect to this MySQL server
将相应用户数据表中的host字段改成''%'';
use mysql;
update user set host=''%'' where user=''root'';
如果报错:ERROR 1062 (23000): Duplicate entry ''%-root'' for key ''PRIMARY''
不用理会,
刷新
flush privileges;
重新进行远程连接
1130 -host ''localhost'' is not allowed to connect t
1130 -host ''localhost'' is not allowed to connect t
cd /usr/share/mysql
mysql -uroot -p 提示输入密码
Welcome to the MySQL monitor. 表示登陆成功。
经过测试,第一种方法是成功的,
第二种方法适用于:ubuntu java
1\授权法:
use mysql;
grant all privileges on *.* to leo@''%'' identified by "leo";
以leo用户在任何地方都可以访问; ()
2\该表法:
可以实现以root用户在任何地方访问数据库
update user set host = ''%'' where user = ''root'';
这样就可以了
再次连接出现 1045
msyql权限问题,使用:mysql -u root -p 查看mysql权限:SELECT DISTINCT CONCAT(''User: '''''',user,''''''@'''''',host,'''''';'') AS query FROM mysql.user; 赋予权限:grant all privileges on *.* to 用户名@''%'' identified by ''密码'' with grant option; 刷新:flush privileges; 后正常连接,请检查。
ERROR 1130 (HY000): Host ''test177'' is not allowed to connect to this MySQL server
异常
在测试环境新搭建的MySQL服务端,启动后登陆MySQL如下异常:
[root@test177 ~]# mysql -u root -po2jSLWw0ni -h test177
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1130 (HY000): Host ''test177'' is not allowed to connect to this MySQL server
由于不能改变hostname
,所以只能通过跳过数据库权限验证,来修改权限。
首先停止MySQL服务端
systemctl stop mysqld
在/etc/my.cnf
中的[mysqld]
选项中添加跳过验证策略skip-grant-tables
,my.cnf文件内容如下:
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
skip-grant-tables
然后重新启动MySQL服务:
systemctl start mysqld
登陆数据库,通过以下两种方法修改权限:
通过表修改
use mysql;
update user set host = ''%'' where user = ''root'' and host=''localhost'';
select host, user from user;
通过授权
GRANT ALL PRIVILEGES ON *.* TO ''account_name''@''%'' IDENTIFIED BY ''password'' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Host ''DESKTOP-QGO5EVD'' is not allowed to connect to this MySQL server
今天在连接 本地的mysql 5.7 的时候 使用本地电脑地址 比如 192.168.1.88 的时候 出现:
Host ''DESKTOP-QGO5EVD'' is not allowed to connect to this MySQL server
百度了一下,,说是 连接名不支持,,,改为 localhost 解决了
今天关于Host ''localhost'' is not allowed to connect to this MySQL server的讲解已经结束,谢谢您的阅读,如果想了解更多关于1130 - Host ''119.137.52.50'' is not allowed to connect to this MySQL server、1130 -host ''localhost'' is not allowed to connect t、ERROR 1130 (HY000): Host ''test177'' is not allowed to connect to this MySQL server、Host ''DESKTOP-QGO5EVD'' is not allowed to connect to this MySQL server的相关知识,请在本站搜索。
本文标签: