MySQL其它操作(了解)和无限分类
其它操作(了解)
1、修改密码
set password for 用户名@主机名 = password('新密码');
set password for root@localhost=password('111111');
2、创建其它用户并分配权限
- 
使用mysql库 use mysql 
- 
查看当前库下有哪些用户 select user from user; 
- 
创建用户 create user 用户名 identified by '密码'; create user lucky identified by '123456'; 
- 
赋予权限 grant all on 库.* to 用户; all:增删改查 grant all on xxxx.* to lucky; 
- 
回收权限 revoke all on 库名.* from 用户名; revoke all on xxxx.* from lucky; 
- 
修改用户名 rename user 原名称 to 新名称 rename user lucky to zhangsan; 
- 
删除用户 drop user zhangsan; 
- 
刷新 flush privileges; 
3、修改表名
alter table 表名 rename to 新表名;
alter table user rename to new_user;
4、数据库的导入导出
- 
导出 mysqldump -uroot -p 库>demo.sql C:\Users\xlg>mysqldump -uroot -p xxxx>xxxx.sql 
- 
导入 mysql -uroot -p 库名<demo.sql C:\Users\xlg>mysql -uroot -p xxxx<xxxx.sql 
无限分类
select * from type order by concat(path,id); 字段连接
| id号 | 商品类别名称 | 父类别pid | 路径path | 
|---|---|---|---|
| 1 | 服装 | 0 | 0, | 
| 2 | 数码 | 0 | 0, | 
| 3 | 食品 | 0 | 0, | 
| 4 | 男装 | 1 | 0,1, | 
| 5 | 女装 | 1 | 0,1, | 
| 6 | 相机 | 2 | 0,2, | 
| 7 | 电脑 | 2 | 0,2, | 
| 8 | 数码相机 | 6 | 0,2,6, | 
| 9 | 单反相机 | 6 | 0,2,6, | 
| 10 | 台式机 | 7 | 0,2,7, | 
| 11 | 男西装 | 4 | 0,1,4, | 
| 12 | 连衣裙 | 5 | 0,1,5, | 
| 13 | 笔记本 | 7 | 0,2,7, | 
| 14 | 联想笔记本 | 13 | 0,2,7,13, | 
本文来自博客园,作者:寻月隐君,转载请注明原文链接:https://www.cnblogs.com/QiaoPengjun/p/16013088.html

 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号