mysql5 7新增新使用者

2022-07-28 21:36:22 字數 899 閱讀 5239

新增新使用者

# 允許本地 ip 訪問 localhsot 127.0.0.1

create user

'test

'@'localhost

' identified by '

123456';

# 允許外網 ip 訪問

create user

'test

'@'%

' identified by '

123456';

# 重新整理許可權

flush privileges;

為使用者建立資料庫

create database test default charset utf8 collate utf8_general_ci;

為使用者分配許可權

# 授予使用者通過外網 ip 對於該資料庫的全部許可權

grant all privileges on `testdb`.* to '

test

'@'%

' identified by '

123456';

# 授予使用者在本地伺服器對該資料庫的全部許可權

grant all privileges on `testdb`.* to '

test

'@'localhost

' identified by '

123456';

# 重新整理許可權

flush privileges;

# mysql8

grant all privileges on `testdb`.* to '

test

'@'localhost';

# 重新整理許可權

flush privileges;

MySQL5 7以上建立新使用者授予許可權

分為以下三步 建立 賦予許可權 重新整理許可權 1 建立使用者 只能本機訪問 localhost create user test localhost identified by 123456 能其他電腦遠端訪問 create user test identified by 123456 2 賦權能...

mysql 新增 刪除新使用者

1.遠端登入mysql mysql h ip u root p 密碼 2.建立使用者 格式 grant 許可權 on 資料庫.to 使用者名稱 登入主機 identified by 密碼 例1 增加乙個test1使用者,密碼為123456,可以在任何主機上登入,並對所有資料庫有查詢,增加,修改和刪除...

ubuntu新增新使用者

sudo adduser username其中username是你要建立的使用者的名字,然後設定密碼還有相關資訊就可以了 用adduser建立後的新使用者是不能使用sudo的,因為還沒有賦予相關root許可權,執行以下 賦予許可權 sudo usermod a g adm username sudo...