导入数据库
新建数据库mysql>create database abc;
选择数据库mysql>use abc;
设置数据库编码mysql>set names utf8;
导入数据mysql>source /home/abc/abc.sql;
创建新用户
create user username identified by 'password';
分配用户权限(所有权限)
grant all privileges on ‘.’ to 'username'@'localhost' identified by 'password';
撤销刚才权限用root用户撤销刚才权限,并重新授权
evoke all privileges on ‘.’ from 'username'@'localhost';
grant all privileges on database.* to 'username'@'localhost' identified by 'password';
指定用户只能执行select和update命令:
grant select,update on database.* to 'username'@'localhost' identified by 'password';
刷新权限
flush privileges;
删除用户
drop user username@localhost;
查询相应的用户及对应的host
select user,host from user;