Mysql創建用戶并授權遠程訪問
進入控制臺,登錄mysql:mysql -u root -q ,輸入密碼后,進入mysql命令行
創建數據庫:create database abc; //以創建abc為例
創建用戶:create user user01@'localhost' identified by 'password'; // 本地訪問
create user user02@'%' identified by 'password'; // 遠程訪問
授權,給user02用戶 賦予 abc 庫所有操作DML DDL:grant all privileges on abc.* to user02;
如果只開通所有庫 查詢權限,命令為: grant select on *.* to 'user02'@'%' identified by 'anotherpassword';

浙公網安備 33010602011771號