异常

在测试环境新搭建的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;

ERROR 1130 (HY000): Host 'test177' is not allowed to connect to this MySQL server的更多相关文章

  1. mysql error 1130 hy000:Host 'localhost' is not allowed to connect to this mysql server 解决方案

    ERROR 1130 (HY000): Host 'localhost' is not allowed to connect to this MySQL server D:\Wamp\mysql-\b ...

  2. ERROR 1130 (HY000) Host ‘hostname’ is not allowed to connect to this MySQL server

    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'; FLUSH PRIVILEGES;

  3. 错误号码1130:Host 'XXX' is not allowed to connect to this MySQL server

    今天在linux机器上装了一个mysql,想通过sqlyog远程连接过去,发生了:错误号码1130:Host 'XXX' is not allowed to connect to this MySQL ...

  4. Mysql数据库连接报错!1130:host XXX is not allowed to connect to this mysql server

    我猜想是可能是连接的用户权限问题.结果这样子操作mysql库,可以解决此问题.在本机登入mysql后,更改 “mysql” 数据库里的 “user” 表里的 “host” 项,从”localhost” ...

  5. ERROR 1130: Host xxx is not allowed to connect to this MySQL server

    在使用MySQL-Front连接mysql的时候发生的这个错误 ERROR 1130: Host xxx is not allowed to connect to this MySQL server ...

  6. 远程连接mysql报错【1130 -host 'localhost' is not allowed to connect to this mysql server】

    远程连接mysql时包如下错误: 1130 -host 'localhost' is not allowed to connect to this mysql server 解决办法 本地用root账 ...

  7. 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数据库 ...

  8. 连接远程数据库时出现 SSH: expected key exchange group packet from server / 2003 - Can't connect to MySQL server on 'XXX' (10038) / 1130 - Host 'XXX' is not allowed to connect to this MySQL server

    昨天在自己的远程服务器上玩,把系统重装了.新装了MySQL,在本地用navicat连接的时候出了几个小问题. 问题一:SSH: expected key exchange group packet f ...

  9. MySql数据库: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:\Progr ...

随机推荐

  1. 7.bash作业控制

    7.作业控制本节讨论作业控制是什么.它怎么工作.以及 Bash 里面怎么使用这些功能7.1 作业控制基础作业控制是指有选择的停止(暂停)并在后来继续(恢复)执行某个进程的能力.通常,用户通过 Bash ...

  2. js中数组的定义方法及注意事项(转)

    1.数组的创建 var name= new Array(); //创建一个数组 name[0]="zhangsan";   //给数组赋值 name[1]="lisi&q ...

  3. shiro学习(三,shiro加密)

    shiro加密 使用MD5加密  认证 //自定义的Realm 域 public class CustomRealmSecret extends AuthorizingRealm { @Overrid ...

  4. init是一个自定义方法名

    init是一个自定义方法名,用于初始化页面变量.上面的代码表示初始化方法是在当前网页加载后执行的(当浏览器打开网页时,触发窗口对象的onload方法,用上面的代码执行名为init的初始化方法).事实上 ...

  5. Git——文件初始化及设置签名

    1. 本地库初始化 命令: git init 效果: 

  6. 微信小程序页面跳转传参方式

    //实现跳转的A页面 jump: function () { let a = 1; let b = 2; wx.navigateTo({ url: '/page/vipOrder/vipOrder?d ...

  7. SQL:MYSQL入门

    MYSQL(关系型数据库管理系统) 参考手册:http://www.w3school.com.cn/sql/index.asp 给大家讲一下数据库:常见的有 ACCESS.MSSSQL.MYSQL.O ...

  8. vuejs 深度监听

    data: { obj: { a: 123 } }, 监听obj中a属性 watch: { 'obj.a': { handler(newName, oldName) { console.log('ob ...

  9. Tomcat 7 简单定制

    Tomcat笔记 安装 wget https://mirrors.huaweicloud.com/apache/tomcat/tomcat-7/v7.0.96/bin/apache-tomcat-7. ...

  10. contos7 yum 安装golang

    一.安装 [root@localhost golang]# yum install golang 安装默认目录为/usr/lib/golang/ 二.配置环境变量 echo "export ...