mysql 新建使用者,賦予許可權

2022-07-19 18:09:14 字數 933 閱讀 8361

mysql 建立乙個使用者 hail,密碼 hail,指定乙個資料庫 haildb 給 hailmysql -u root -ppassworduse mysql;insert into user(ho

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;

mysql新建使用者和賦予許可權

登入mysql mysql u root p 密碼 建立使用者 insert into mysql.user host,user,password values localhost hbchen p assword hbchen 這樣就建立了乙個名為 hbchen 密碼為 hbchen 的 使用者。...

MySQL資料庫新建使用者並賦予許可權

首先使用root許可權登入mysql,切換到mysql資料庫,create user test localhost indentified by 123456 grant all on 資料庫名.to test localhost flush privileges create user test ...

oracle中新建使用者和賦予許可權

1.新建個使用者 create user xx 使用者名稱 identified by 密碼 alert user 使用者名稱 identified by 新密碼 修改使用者密碼 因為新建的使用者和預設的使用者是鎖住的,沒有許可權。所以新建使用者後要給使用者賦予許可權 grant dba to 使用...