MySQL的用户账户管理

    xiaoxiao2023-11-27  166

    MySQL的用户账号管理 1、开启MySQL远程连接 1、su 2、cd /etc/mysql/mysql.conf.d/ 3、subl mysqld.cnf #bind-address = 127.0.0.1 4、/etc/init.d/mysql restart 2、添加授权用户 1、用root用户登录mysql mysql -uroot -p 2、授权 grant 权限列表 on 库.表 to "用户名" @ "%" identified by "密码" with grant option; 权限列表:all privileges、select、insert 库.表: *.* 所有库的所有表 @后" "中填写IP地址,%表示任意IP均可 3、示例 1、添加授权用户tiger,密码123,对所有库的所有表有所有权限 grant all privileges on *.* to "tiger" @ "%" identified by "123" with grant option; 2、添加用户rabbit,对db1库有所有权限 grant all privileges on db1.* to "rabbit"@"%" identified by "123" with grant option; 4、查询现在已有用户 1、使用mysql库 use mysql; 2、查询 select user,host from user;
    最新回复(0)