mysql权限问题
-- mysql数据库权限问题:root :拥有所有权限(可以干任何事情) -- 权限账户,只拥有部分权限(CURD)例如,只能操作某个数据库的某张表 -- 如何修改mysql的用户密码? -- password: md5加密函数(单向加密) SELECT PASSWORD('root'); -- *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B -- mysql数据库,用户配置 : user表 USE mysql; SELECT * FROM USER; -- 修改密码 UPDATE USER SET PASSWORD=PASSWORD('123456') WHERE USER='root'; -- 创建账户 create user 'eric'@'localhost' identified by '123456'; 'eric'@'localhost'表示只允许本地访问 'eric'@'%' 表示允许外部IP访问 -- 分配权限账户 GRANT SELECT ON day16.employee TO 'eric'@'localhost' IDENTIFIED BY '123456'; GRANT DELETE ON day16.employee TO 'eric'@'localhost' IDENTIFIED BY '123456';
备份与还原
备份mysqldump -u root -p day17 > c:/bak.sql 恢复 先建立一个数据库(假设day17)然后再执行: mysql -u root -p day17 < d:/back.sql 导出数据库的若干列数据到文本
select col1,col2, ... from table_name where xxxxxx into outfile '文本或者excel的路径' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"';