新增:
mysql > CREATE USER '帳號'@'連線位置' IDENTIFIED BY '密碼';
設定權限:
mysql > GRANT 權限 ON db.table TO '帳號'@'連線位置';
連線位置:
%:完全開放
localhost : 本機
8.8.8.8:IP
權限:
ALL PRIVILEGES : 全開
SELECT,INSERT,UPDATE,DELETE,CREATE : 指定權限
套用權限:
mysql > FLUSH PRIVILEGES;
常用指令:
mysql > CREATE USER 'dbuser'@'localhost' IDENTIFIED BY 'dbpassword';
mysql > GRANT ALL PRIVILEGES ON *.* TO 'dbuser'@'localhost';
mysql > FLUSH PRIVILEGES;