1、给一个数据库分配只读账号
GRANT SElECT ON `bstic`.* TO 'readonly'@'%' IDENTIFIED BY "123456";
or
GRANT SElECT ON bstic.* TO 'readonly'@'%' IDENTIFIED BY "123456";
2、多个数据库分配只读权限(只能单独一个一个的分配)
GRANT SELECT ON *.* to 'yu'@'10.10.10.10' IDENTIFIED BY '123456';
GRANT SElECT ON `bstic-1`.* TO 'readonly'@'%' IDENTIFIED BY "123456";
GRANT SElECT ON `bstic-2`.* TO 'readonly'@'%' IDENTIFIED BY "123456";
3、一个数据库读写权限账号
grant all privileges on `bstic`.* to 'yu'@'10.10.10.10' identified by '123456';
4、多个数据库读写权限账号(只能单独一个一个的分配)
grant all privileges on `bstic`.* to 'yu'@'10.10.10.10' identified by '123456';
grant all privileges on `bstic-1`.* to 'yu'@'10.10.10.10' identified by '123456';
5、其中一个数据库读写权限,其他数据库只读权限
GRANT SELECT ON *.* to 'yu'@'10.10.10.10' IDENTIFIED BY '123456';
grant all privileges on `bstic`.* to 'yu'@'10.10.10.10' identified by '123456';
6、命令行查看用户权限
show grants for 'yu'@'%';
7、删除用户
DROP USER 'yu'@'localhost';