• mysql登录密码相关


    设置root登录密码

    方法一:用root 进入mysql后

    mysql>set password =password('你的密码');

    mysql>flush privileges;

    方法二:使用grant语句 

    mysql>grant all on *.* to 'root'@'localhost' identified by  '你的密码';

    mysql>flush privileges;

    方法三:进入mysql库修改user表

    mysql>use mysql;

    mysql>update user set password=password('你的密码')  where user='root'; 

    mysql>flush privileges;

    让指定用户能远程登录mysql

    方法一:
    mysql> create user danny identified by '123';
    mysql> use mysql;
    mysql> update user set Host='%' where user = 'danny';//让danny可以通过ip访问

    登录示例:

    mysql  -udanny -p123 -h 192.168.1.1   

    给用户赋权
    mysql服务器上
    用root用户登录赋权;
    mysql>grant all on *.* to tom;
    mysql> flush privileges;
    即可,也可部分赋权。

    方法二:
    在mysql数据库上通过root创建用户并给予权限
    mysql>grant all on *.* to 'danny'@'%' identified by '123';
    mysql>flush privileges;

    注:以上两种方法都不能直接通过localhost在Mysql服务器上实现本地登录,只能通过指定mysql服务器ip登录的方式。如:
    [root@Dannyserver opt]# mysql -udanny -p123
    ERROR 1045 (28000): Access denied for user 'tom'@'localhost' (using password: YES)

    [root@Dannyserver opt]# mysql -udanny -p123 -h12.1.1.1(服务器ip) //这样通过-h指定ip才能登录

  • 相关阅读:
    mysql联合索引命中条件
    Shiro知识初探(更新中)
    Java中使用MongoTemplate进行分批处理数据
    Java中String时间范围比较
    使用ReentrantLock
    使用Condition
    python的坑--你知道吗?
    python基础--函数全解析(1)
    CSS基本语法及页面引用
    HTML学习汇总
  • 原文地址:https://www.cnblogs.com/dannylinux/p/8057661.html
Copyright © 2020-2023  润新知