mysql 建立一個使用者 hail,密碼 hail,指定一個數據庫 haildb 給 hail
mysql -u root -p
password
use mysql;
insert into user(host,user,password) values("localhost","hail",password("hail"));
flush privileges;
create database haildb;
grant all privileges on haildb.* to hail@localhost identified by "hail";
如果想指定部分許可權給使用者
grant select,update on haildb.* to hail@localhost identified by "hail";
delete from user where user="hail" and host="localhost";
drop database haildb;
修改指定使用者密碼
update user set password=password("new_password") where user="hail" and host="localhost";
mysql 建立一個使用者 hail,密碼 hail,指定一個數據庫 haildb 給 hail
mysql -u root -p
password
use mysql;
insert into user(host,user,password) values("localhost","hail",password("hail"));
flush privileges;
create database haildb;
grant all privileges on haildb.* to hail@localhost identified by "hail";
flush privileges;
如果想指定部分許可權給使用者
grant select,update on haildb.* to hail@localhost identified by "hail";
flush privileges;
delete from user where user="hail" and host="localhost";
flush privileges;
drop database haildb;
修改指定使用者密碼
update user set password=password("new_password") where user="hail" and host="localhost";
flush privileges;