Mysql--- 权限管理和备份
1.权限管理:root
创建用户:
create user chen identified by '123456
修改密码:
update mysql.user set authentication_string='123456' where Host='localhost'
and User='root'
修改当前用户密码:
set password =PASSWORD('123456')
创建用户密码:
create user Alex identified by '123456';
修改指定用户名密码:
set password for alex=PASSWORD('123456');
重命名:
rename user song to chen
授权:
grant all privilleges on *.* to chen
grant all privilleges on *.* to root@localhost with grant option
查看权限:
show grants for chen
show grants for root@localhost
撤销权限:删除用户权限
revoke all privilleges on *.* from chen
删除用户:
drop user chen;
2.数据库备份:
备份数据库:
命令行:cmd 》导出表 多表 数据库
mysqldump -hlocalhost -uroot -p123456 shop users >D:\1.sql
mysqldump -hlocalhost -uroot -p123456 shop >d:/1.sql
导入:
mysql> source D:/1.sql
mysql -uroot -p12345 库名<备份文件位置
浙公网安备 33010602011771号