mysql 常用sql与命令

1. 如何禁用和启用mysql外键约束

```

SET foreign_key_checks = 0; 禁用外键
SOURCE dump_file_name;      进行SQL查询
 SET foreign_key_checks = 1; 恢复外键

```

2. 把字段改为自动增长 

```

SET foreign_key_checks = 0;
ALTER TABLE zz_news MODIFY COLUMN id BIGINT(20) NOT NULL AUTO_INCREMENT;
SET foreign_key_checks = 1;

``` 

3. 赋权

```

grant all privileges on *.* to root@‘%’ identified by ‘1234’;

flush privileges; 

```

 

posted @ 2016-02-25 10:12  cglworkBook  阅读(183)  评论(0编辑  收藏  举报