1.登錄MySQL
mysql -u root -p
2.添加新用戶(允許所有ip訪問)
create user
'test'
@
'*'
identified by
'123456'
;(test:用戶名,*:所有ip地址,123456:密碼)
3.創建數據庫
create database testdb;
4.為新用戶分配權限
grant all privileges on `testdb`.* to
'test'
@
'%'
identified by
'123456'
;
5.刷新權限
flush
privileges;