zoukankan      html  css  js  c++  java
  • 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才能登录

  • 相关阅读:
    最小移动次数使数组元素相等
    计算几何
    北校门外的回忆
    洗衣服
    HDU1046:Gridland
    注册机的实现如(istarMenu CORE Keygen)
    是你吗?
    (译)KVO的内部实现
    通过UIColor转换为UIImage
    Palindrome Number 解题报告
  • 原文地址:https://www.cnblogs.com/dannylinux/p/8057661.html
Copyright © 2011-2022 走看看