MySQL新建用户、库、授权

1、新建用户

#其中HOST可以用%表示所有主机

CREATE USER 'username'@'host' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;

2、删除用户

USE mysql;
DELETE FROM user WHERE User="username";

3、新建库

CREATE DATABASE table_name;

4、给用户授权库

GRANT ALL PRIVILEGES ON db_name.* TO user_name

Leave a Reply

Your email address will not be published.