【小(xiǎo)編推薦】mysql創建用(yòng)戶并授權,設置允許遠 ×↔(yuǎn)程連接

2018-09-13   |&nb £sp;  發布者: & £÷nbsp; |   查看(kàn):®σ≥3320次

php

一(yī)、創建用(yòng)戶并授權

1、登錄mysql

  mysql -u root -q

2、創建數(shù)據庫

  create database dbdata;//以創建db©₹÷₽data為(wèi)例

3、創建用(yòng)戶

創建user01,隻能(néng)本地(dì)訪問(wèn)>±β 

  create user user01@'locaε>$lhost' identified by 'password"™•>';

創建user02,可(kě)以遠(yuǎn)程訪問(wèn)

  create user user02@'%‌π₩ε9; identified by 'password'

4、修改用(yòng)戶密碼

以user01為(wèi)例:

  set password for ★☆₩¥9;user01'@'localhost'=pas✘©₹sword('anotherpassword') γ

5、授權

授予user01管理(lǐ)dbdata的(de)全部權限✘∏ε★

  grant all privileges on ↔±™ dbdata.* to user01;

授予user02查看(kàn)權限,并修改密碼

  grant select on *.* to 'use"γ£☆r02'@'%' i∞∑ dentified by 'anotherpass♣ word';




記得(de)開(kāi) 阿裡(lǐ)雲安全組 和(hé)∑♦☆防火(huǒ)牆。