mysql 建立資料庫和使用者

2021-08-27 21:45:17 字數 482 閱讀 3623

1、用管理員賬號登陸mysql;

2、建立資料庫:create database db01

3、建立使用者:

create user user01@'localhost' identified by 'password1'; // user01只能本地訪問

create user user02@'%' identified by 'password1';  // user02可以遠端訪問

4、修改user01密碼:set password for 'user01'@'localhost' = password('password2')

5、授權:

a)、user01管理db01全部許可權:grant all privileges on db01.* to user01

b)、user02檢視許可權,並修改密碼:grant select  on *.* to 'user02'@'%' identified by 'password2'

mysql資料庫和使用者建立

1.建立資料庫 create database test 2.建立使用者 任何終端都可以連線 grant select,insert,update,delete on test.to user identified by 123456 只讓某個位址段連線 grant select,insert,up...

mysql建立資料庫,建立使用者

建立資料庫 create database test use test 建立使用者 create user test identified by test 給使用者賦權 grant all on test.to test 建立資料庫 命令 create database databasename 例...

Mysql建立資料庫使用者

通常情況下我們在編寫 的過程中 也就是在開發過程中 一直使用的是我們本地的mysql,而且使用者都是root使用者,最高許可權的使用者,但是我們如果在公司上班的時候,公司的領導不會讓你擁有root許可權,這樣存在風險.這就需要建立普通的使用者.開啟自己的cmd,輸入mysql u root p 輸入...