• CentOS下mysql忘记root密码解决办法,centOS7中Host is not allowed to connect


    1,停止mysql服务命令            

    systemctl stop mysqld

            2,修改配置文件/etc/my.cnf

                在[mysqld]下添加

               skip-grant-tables

                意思是忽略验证,保存并退出

            3,启动Mysql命令            

    systemctl start mysqld

             4,修改密码

                执行命令:mysql

                Welcome to the MySQL monitor. Commands end with ; or g.

                Your MySQL connection id is 3 to server version: 3.23.56
                Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
                mysql> USE mysql ;
                Database changed
                mysql> UPDATE user SET Password = password ( 'new-password' ) WHERE User = 'root' ;
                Query OK, 0 rows affected (0.00 sec)
                Rows matched: 2 Changed: 0 Warnings: 0
                mysql> flush privileges ;
                Query OK, 0 rows affected (0.01 sec)

                mysql> quit

            5,改回配置 :删除 /etc/my.cnf 文件中的 skip-grant-tables,重启服务

                systemctl restart mysqld

    centOS7中Host is not allowed to connect to this MySQL server解决方法

    原因是Centos不允许远程登录mysql

    解决办法:

    登录 MySQL,执行:mysql -u root -p  (输入密码)
    执行: use mysql
    执行: update user set host ='%' where user = 'root'; 执行会报错,不影响结果 (如果你不是root登录,修改成你需要的账号)
    执行: flush privileges;

  • 相关阅读:
    mybatis模糊查询语句
    Java中解压文件名有中文的rar包出现乱码问题的解决
    tomcat服务器开启gzip功能的方法
    asp.net 操作word
    asp.net webservice 返回json数据乱码解决方法
    阿里云服务器mysql修改编码问题
    阿里云服务器问题:访问
    EasyUI 在aspx页面显示高度不正常解决办法
    C# 或 JQuery导出Excel
    如何分离数据库 (SQL Server Management Studio)
  • 原文地址:https://www.cnblogs.com/q149072205/p/12850315.html
Copyright © 2020-2023  润新知