随笔分类 -  SQL

摘要:方式一: 导出 SELECT * FROM 数据库.表名 INTO OUTFILE '文件存放位置'; # [Err] 1290 - The MySQL server is running with the --secure-file-priv option so it cannot execute 阅读全文
posted @ 2021-10-22 22:55 lightbc 阅读(285) 评论(0) 推荐(0) 编辑
摘要:1、登录主数据库,进行如下操作: # 创建账号 create user 账号@localhost identified by '密码'; # 账号赋权 grant replication slave on *.* to 账号@localhost with grant option; # 刷新权限 f 阅读全文
posted @ 2021-08-12 21:35 lightbc 阅读(69) 评论(0) 推荐(0) 编辑
摘要:1、查看MySQL版本 SELECT VERSION();//5.7.26 2、查看是否开启日志功能 SHOW VARIABLES LIKE 'log_bin';//OFF(未开启),ON(开启) 3、查看MySQL的安装路径 SHOW VARIABLES LIKE 'basedir'; 4、在安装 阅读全文
posted @ 2021-08-11 22:51 lightbc 阅读(5068) 评论(0) 推荐(0) 编辑
摘要:报错原因:当使用union或union all时查询出的字段的排序规则不同。 解决方法: select column(列名) collate utf8_unicode_ci(排序规则)from table(表名) union/union all select column(列名) collate u 阅读全文
posted @ 2021-04-02 20:14 lightbc 阅读(1585) 评论(0) 推荐(0) 编辑
摘要:一条语句查询三种类型的总数量。 select count(case when type=0 then 1 else null end) t1,count(case when type=1 then 1 else null end) t2,count(case when type=2 then 1 e 阅读全文
posted @ 2020-01-18 21:46 lightbc 阅读(542) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示