用戶管理
創建用戶
create user 用戶名 identidied by '密碼';
修改當前用戶密碼
set password = password('密碼');
修改指定用戶密碼
set password for 用戶名 = password('密碼');
重命名
rename user 舊名字 to 新名字;
用戶授權 all privileges 全部的權限除了授權 庫.表
grant all privileges on *.* to 用戶名;
查詢權限
show grants for 用戶;
show grants for root@localhost;
撤銷權限
revoke all procoleges on *.* from 用戶;
刪除用戶
drop user kuangshen;
數據庫備份
使用命令行導出
mysqldump -hlocalhost -u 用戶名 -p 密碼 數據庫 表名 表名 .. > 物理磁盤位置/文件名
導入
登陸過的切換到指定數據庫導入
source d:/a.sql
這樣就可以把sql文件導入到數據庫啦。