mysql创建、授权、删除用户sql

来源:互联网 发布:海纳百川软件安卓版 编辑:程序博客网 时间:2024/05/22 03:52
1、查看系统用户:
a、SELECT DISTINCT CONCAT('User: ''',user,'''@''','localhost',''';') AS query FROM mysql.user;
b、user mysql;
           select * from user;
2、创建用户:
CREATE USER 'crmuser'@'localhost' IDENTIFIED BY 'crmuser0704';
3、授权:grant select, insert, update on data.t_b_software to crmuser@'localhost';
        grant all privileges on data.* to crmuser@'localhost';
        flush privileges;
4、登录mysql:
mysql -u root -p后输入密码
5、删除用户:
Delete FROM user Where User='crmuser' and Host='localhost';
原创粉丝点击