mysql建立使用者

2021-09-22 16:56:52 字數 836 閱讀 2160

建立用於localhost連線的使用者並指定密碼 

mysql> create user 'pcom'@'localhost' identified by 'aaa7b2249';

query ok, 0 rows affected (0.00 sec)

建立資料庫

mysql> create database pcom default character set utf8 collate utf8_bin;

query ok, 1 row affected (0.00 sec)

給本地使用者授權, 這裡不需要指定密碼

mysql> grant all on pcom.* to 'pcom'@'localhost';

query ok, 0 rows affected (0.00 sec)

給其他ip位址下的使用者授權, 注意: 這裡必須指定密碼, 否則就可以無密碼訪問

mysql> grant all on pcom.* to 'pcom'@'192.168.0.0/255.255.0.0' identified by 'aaa7b2249';

query ok, 0 rows affected (0.00 sec)

同理 mysql> grant all on pcom.* to 'pcom'@'172.20.0.0/255.255.0.0' identified by 'aaa7b2249';

query ok, 0 rows affected (0.00 sec)

使設定生效

mysql> flush privileges;

done!

mysql 建立使用者指令碼 Mysql使用者建立指令碼

我試圖自動化mysql使用者建立過程。我想到建立乙個包含mysql使用者建立語句的臨時檔案,那麼我會這樣稱呼 mysql u root proot 這裡是我的臨時檔案的內容 drop database if exists mytestdatabase create database mytestda...

mysql 建立使用者

mysql grant all privileges on to root identified by with grant option query ok,0 rows affected 0.02 sec 表示是所有的外部機器,如果指定某一台機,就將 改為相應的機器名 mysql grant al...

MYSQL 建立使用者

一,建立使用者 命令 create user username host identified by password 說明 username 你將建立的使用者名稱,host 指定該使用者在哪個主機上可以登陸,如果是本地使用者可用localhost,如果想讓該使用者可以從任意遠端主機登陸,可以使用萬...