zoukankan      html  css  js  c++  java
  • mysql,本地连接看到的数据库不全,远程连接看到的数据库是完整的

    xshell本地连接数据库,show databases;

    下面只显示了两个数据库,mysql数据库看不到,问题原因是:用户没有权限

    navicat远程连接,比上面看到的数据库多了很多,能看到mysql等数据库

    停掉mysql,重启,mysqld_safe --skip-grant-tables,或者vi /etc/my.cnf,在[mysqld]段中加入 skip-grant-tables

    重新打开一个ssh连接,对mysql数据库的user表进行操作,建议用navicat进行操作。

    select * from user;

    如果已经存在了host为localhost的记录,则先删除该记录,delete from user where host='localhost';

    创建新增权限的insert语句:选中一行或者多行,可以快速创建插入或者更新的sql语句

    粘贴并执行(下面密码为空)

    INSERT INTO `user` VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','','0','0','0','0','','');

    也可以写为:

    INSERT INTO `user` VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','');

    说明:%不包含localhost

    关闭所有数据库的连接,停止服务

    启动服务

    xshell本地连接数据库,密码为空(也可以设置密码,参考:https://www.cnblogs.com/UncleYong/p/10739530.html

    展示了所有库

    参考:

    centos7中,mysql连接报错:1130 - Host ‘118.111.111.111’ is not allowed to connect to this MariaDB server

    https://www.cnblogs.com/UncleYong/p/10070400.html

    mysql在windows(含客户端工具)及linux(yum)环境下安装

    https://www.cnblogs.com/UncleYong/p/10739530.html

  • 相关阅读:
    格式化你的git message
    git merge
    Git远程操作详解
    Limit
    EmailService
    RequestContextHolder getHttpServletRequest
    spring boot GlobalExceptionHandler @RestControllerAdvice @ExceptionHandler
    redis 的雪崩和穿透?
    FileUtil
    getWeekDay TimeUtil
  • 原文地址:https://www.cnblogs.com/uncleyong/p/10931195.html
Copyright © 2011-2022 走看看