zoukankan      html  css  js  c++  java
  • mysql初设密码及允许远程访问

    1、设置密码:

    #mysql

      >set password for root@localhost = password('123456');    //设置密码

    或:

      > grant all privileges on *.* to root@"127.0.0.1" identified by "123456" WITH GRANT OPTION;//设置密码

      >FLUSH PRIVILEGES;//设置生效

    2、查看所有账号授权

    >use mysql;//选择库

    #查看所有账号及权限,如有空密码账号建议删除

    >select host,user,password from user;

    >delete from user where USER='';  //删除空密码

    >exit;

    2、登录:

    #mysql -h127.0.0.1 -u root -p

    输入密码:123456

    3、授权:

    >grant all privileges on *.* to root@"localhost" identified by "123456" WITH GRANT OPTION;

    >FLUSH PRIVILEGES;

    >grant all privileges on *.* to root@"xxx.xxx.xxx.xxx" identified by "123456" WITH GRANT OPTION;

    >FLUSH PRIVILEGES;

    >grant all privileges on *.* to root@"%" identified by "123456" WITH GRANT OPTION;

    >FLUSH PRIVILEGES;

    >system clear;//同linux的clear命令

    4、查看数据库端口号:

    >show global variables like 'port';

    或:

    # find / -name 'my.cnf'                                                                                                                                   

    # vi ***/mysql/etc/my.cnf

     5、远程连接:

    #mysql -h该主机ip -uroot -p -P3358

     

  • 相关阅读:
    Mybatis中的动态SQL
    Mybatis核心知识点
    Java8之Stream详解
    多线程知识点总结(二)
    多线程知识点总结(一)
    数据库中的行锁和表锁
    数据库中的sql完整性约束
    数据库中的sql语句总结
    全局变量
    打印 输出 debug
  • 原文地址:https://www.cnblogs.com/Tanwheey/p/14681819.html
Copyright © 2011-2022 走看看