MySQL建立使用者授權訪問

2021-06-22 14:26:45 字數 455 閱讀 3449

mysql -u root -p

#輸入密碼

建立乙個使用者名為zzy,密碼為zzy的mysql普通使用者,並且授權該使用者只有對zzy這個資料庫有操作許可權.

1.1第一種方式:

use mysql;

insert into user (user,host,password) values ('zzy','localhost',password('zzy'));

#授權grant all privileges on zzy.* to zzy;

#重新整理許可權表

flush privileges;

1.2第二種方式:

create user zzy@'localhost'  identified by 'zzy'

#授權grant all privileges on zzy.* to zzy;

#flush privileges;

mysql遠端訪問授權,建立使用者並授權

mysql預設root使用者沒有密碼,輸入mysql u root 進入mysql 1 初始化root密碼 進入mysql資料庫 mysql update user set password password 123456 where user root 修改mysql密碼 mysqladmin u...

Mysql建立使用者 授權

建立使用者命令 create user 使用者名稱 localhost identified by 密碼 create user 使用者名稱 192.168.1.101 idendified by 密碼 create user 使用者名稱 identified by 密碼 create user 使...

mysql 建立使用者 授權

b 1 建立使用者 b 可以在任何地方登陸 create user test identified by test123 或create user test identified by test123 在本地登陸 create user test localhost identified by te...