1. 程式人生 > >MySQL命令記錄

MySQL命令記錄

post 帳戶 sql leg 登錄 host sql命令 mysq pri

1,授權用戶遠程訪問

grant all privileges on *.* to ‘username‘@‘%‘ identified by ‘password‘ with grant option;

flush privileges;

2,登錄

mysql -u"username" -p"pwd" -hlocalhost -P3306

3,創建只讀帳戶

GRANT SELECT ON *.* TO ‘username_r‘@‘localhost‘ IDENTIFIED BY ‘pwd‘;

4,創建讀寫賬戶

GRANT ALL ON *.* TO ‘username_r‘@‘localhost‘ IDENTIFIED BY ‘pwd‘;

MySQL命令記錄