• 安装mysql后必做的两件事


    1..删除掉不需要的用户

    查看用户表
    mysql> SELECT User,Host FROM mysql.user; +------+-------------------------+ | User | Host | +------+-------------------------+ | root | 127.0.0.1 | | | izwz9cl4i8oy1reej7o8pmz | | root | izwz9cl4i8oy1reej7o8pmz | | | localhost | | root | localhost | +------+-------------------------+ 5 rows in set (0.00 sec)
    删除用户最好再SELECT一次,以免删除错误 mysql
    > SELECT User,Host FROM mysql.user WHERE User=""; +------+-------------------------+ | User | Host | +------+-------------------------+ | | izwz9cl4i8oy1reej7o8pmz | | | localhost | +------+-------------------------+ 2 rows in set (0.00 sec)
    删除用户 mysql
    > DELETE FROM mysql.user WHERE User=""; Query OK, 2 rows affected (0.00 sec) mysql>

    2..设置密码

    对root用户设置密码
    mysql> UPDATE mysql.user SET PASSWORD=PASSWORD("syj2FBZ") WHERE User='root'; Query OK, 3 rows affected (0.00 sec) Rows matched: 3 Changed: 3 Warnings: 0
    刷新权限 mysql
    > mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec)
    退出 mysql
    > quit Bye

    测试无密码登录
    [root@iZwz9cl4i8oy1reej7o8pmZ ~]# mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) [root@iZwz9cl4i8oy1reej7o8pmZ ~]#

    测试使用密码登录
    [root@iZwz9cl4i8oy1reej7o8pmZ ~]# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 Server version: 5.1.73 Source distribution Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
    欢迎转发! 请保留源地址: https://www.cnblogs.com/NoneID
  • 相关阅读:
    TestNG
    K近邻算法
    Python解决乱码问题
    Log4J 配置
    多线程死锁
    hadooplzo安装出错的解决方法
    B树
    设计模式
    整数序列化
    Maven
  • 原文地址:https://www.cnblogs.com/NoneID/p/6689194.html
Copyright © 2020-2023  润新知