zoukankan      html  css  js  c++  java
  • Linux下mysql新建账号及权限设置

    1、权限赋予

    说明:mysql部署在服务器A上,内网上主机B通过客户端工具连接服务器A以进行数据库操作,需要服务器A赋予主机B操作mysql的权限

    1.1 在服务器A上进入mysql,假设在服务器A上mysql的账户是root:

    mysql -u root -p

    然后回车键入密码!

    1.2 赋予主机B操作数据库的权限

    mysql> grant usage on *.* to username@192.168.0.1 identified by 'password';

    说明:赋予username@192.168.0.1 使用所有数据库的权限,在主机192.168.0.1上使用username账户登录,密码为:password

    mysql> grant usage on *.* to username identified by 'password';

    说明:赋予username使用所有数据库的权限,在所有主机上使用username账户登录,密码为:password

    也可写成

    1
    mysql> grant usage on *.* to 'username'@'%' identified by 'password';
    mysql> grant all privileges on newdb.* to username@192.168.0.1;

    说明:赋予username@192.168.0.1 操作数据库newdb的最高权限,在主机192.168.0.1上使用username账户登录,无密码

    举例:

    mysql> grant all privileges on *.* to root@192.168.0.1 identified by '123456' ;

    说明:赋予root@192.168.0.1 使用所有数据库的权限,在主机192.168.0.1上使用root账户登录,密码为:123456

    2、移除账号

    mysql> drop user root@192.168.0.1;

    说明:移除账户root,这样,主机192.168.0.1就不再可以使用root用户操作服务器A上的数据库

    海纳百川 有容乃大 壁立千仞 无欲则刚
  • 相关阅读:
    django实现github第三方本地登录
    django扩展User模型(model),profile
    WSGI
    Linux查看配置文件中未被注释的有效配置行
    virsh 命令
    qemu-img命令
    python logging
    oslo.messaging
    集成kafka的身份认证(SASL/PLAIN)到kubernets环境中
    Helm基础知识
  • 原文地址:https://www.cnblogs.com/luchangyou/p/5889551.html
Copyright © 2011-2022 走看看