- 創建用戶
CREATE USER '用戶名'@'localhost' IDENTIFIED BY '密碼';
- 給用戶賦予權限
所有權限:grant all privileges on databasename.tablename to '用戶名'@'localhost';
增刪查改:grant select,delete,update,create,drop on databasename.tablename to '用戶名'@'localhost';
如果要操作所有的數據庫databasename用*,如果要操作所有的表tablename用*
對用戶賦予所有庫所有表所有權限:grant all privileges on *.*to '用戶名'@'localhost';
最後需要刷新權限表:flush privileges;
- 查看錶結構
desc tablename;
- 查看bin-log是否開啓
show variables like '%log_bin%';