MySQL创建用户并指定数据库权限

    xiaoxiao2021-03-25  23

    本地访问

    创建一个“本地”用户并授权只能访问某个特定的数据库,这里的wxshop.* 表示数据库.表(*:所有表)

    CREATE USER 'dev_wxshop'@'localhost' IDENTIFIED BY 'dev_wxshop'; GRANT SELECT, INSERT, UPDATE, REFERENCES, DELETE, CREATE, DROP, ALTER, INDEX, CREATE VIEW, SHOW VIEW ON `wxshop`.* TO 'dev_wxshop'@'localhost'; FLUSH PRIVILEGES;

    任何服务器访问

    创建一个“任何机器都可以访问”用户并授权只能访问某个特定的数据库

    CREATE USER 'dev_wxshop'@'%' IDENTIFIED BY 'dev_wxshop'; GRANT SELECT, INSERT, UPDATE, REFERENCES, DELETE, CREATE, DROP, ALTER, INDEX, CREATE VIEW, SHOW VIEW ON `wxshop`.* TO 'dev_wxshop'@'%'; FLUSH PRIVILEGES;
    转载请注明原文地址: https://ju.6miu.com/read-50202.html

    最新回复(0)