zoukankan      html  css  js  c++  java
  • 删除mysql的root用户,重建本地用户及远程用户

    一、重建本地用户:
    #vi /etc/my.cnf 
    [mysqld]
    skip-grant-tables
    # service mysql restart
    Shutting down MySQL..                                                                                                                                                 done
    Starting MySQL.                    

    # mysql -uroot -p
    Enter password: 
    mysql> insert into mysql.user (host, user, password,ssl_cipher,x509_issuer,x509_subject) values ('localhost', 'root', password('root'),'','','');
    Query OK, 1 row affected (0.00 sec)
    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)
    mysql> grant all privileges on *.* to 'root'@'localhost' identified by 'root' with grant option;
    Query OK, 0 rows affected (0.00 sec)
    mysql>

    vi /etc/my.cnf 
    [mysqld]
    #skip-grant-tables
    # service mysql restart
    Shutting down MySQL..                                                                                                                                                 
    Starting MySQL.   

    三、通过本地用户重建远程用户:
    mysql -uroot -proot
    mysql> select user,host from mysql.user;
    +----------+-----------+
    | user     | host      |
    +----------+-----------+
    | root     | localhost |
    +----------+-----------+
    5 rows in set (0.00 sec)

    mysql>  grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
    Query OK, 0 rows affected (0.00 sec)

    mysql> select user,host from mysql.user;
    +----------+-----------+
    | user     | host      |
    +----------+-----------+
    | root     | %         |
    | root     | localhost |
    +----------+-----------+

  • 相关阅读:
    B/S 和 C/S
    SQL 注入
    软件测试
    Spring的注解方式
    测试开发题目
    策略模式
    设计模式
    单例模式
    读写文件
    对List里的对象元素进行排序
  • 原文地址:https://www.cnblogs.com/guarder/p/5432287.html
Copyright © 2011-2022 走看看