mysql5

2016/04/13 mysql

Mysql5.7常用操作

===============================

连接mysql

root帐号

mysql -h 172.17.219.222 -u www -pXXX

work帐号

mysql -h 172.17.219.222 -u work -pXXX

===============================

创建用户

CREATE USER ‘work’@’127.0.0.1’ IDENTIFIED BY ‘XXX’ PASSWORD EXPIRE NEVER;
CREATE USER ‘work’@’127.0.0.1’ IDENTIFIED BY ‘XXX’ PASSWORD EXPIRE NEVER;

CREATE USER ‘work’@’127.0.0.1’ IDENTIFIED WITH mysql_native_password AS ‘***’;

===============================

给用户授权

REVOKE GRANT OPTION ON . FROM ‘work’@’127.0.0.1’; GRANT SELECT, INSERT, UPDATE, DELETE ON . TO ‘work’@’127.0.0.1’; REVOKE GRANT OPTION ON . FROM ‘work’@’127.0.0.1’; GRANT SELECT, INSERT, UPDATE, DELETE ON . TO ‘work’@’127.0.0.1’ REQUIRE NONE WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;

===============================

删除用户

use mysql;delete from user where User=’work’;

===============================

取消授权

REVOKE GRANT OPTION ON . FROM ‘work’@’127.0.0.1’; REVOKE GRANT OPTION ON . FROM ‘work’@’127.0.0.1’;


Search

    Table of Contents