![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
mysql
文章平均质量分 52
suanday_sunny
晒太阳吧~
展开
-
突然发现“mysql Like查询默认是不区分大小写的”
原来我用的ci字符集,详解:https://www.cnblogs.com/zi-xing/p/4298697.html原创 2021-12-01 12:24:08 · 192 阅读 · 0 评论 -
数据库使用一些注意事项
查询条件不要有计算,如colA/5=colB,查询条件操作符两边的字段使用相同的数据类型,不要让数据库默默的转换数据类型消耗资源与时间;查询条件中,尽量不要使用函数自定义函数也尽量少用union尽量少用,union后的结果没有索引查询条件中,尽量不写“不等于”判断GroupBy、OrderBy、Distinct尽量使用索引字段频繁的查询条件最好建立索引查询条件关联字段最好建立索引尽量不用子查询如果字段会出现在查询条件中,这样的字段最好给出不是null的默认值一个表原创 2021-02-05 09:39:13 · 747 阅读 · 1 评论 -
MySQL1.5.7相关
安装之后需要立即修改root密码,用默认密码登录,然后修改密码grep "password" /var/log/mysqld.logA temporary password is generated for root@localhost: >wTexVUgz28n找到mysqld的路径which mysqldMySQL安装之后,没有修改仅有的用户root默认密码,密码很快过期,因此需要修改mysql配置#忘记MySQL修改默认root密码,#1.找到配置文件[.原创 2020-09-01 17:40:19 · 158 阅读 · 0 评论 -
centos 安装MySQL
Mysql安装仓库wget http://repo.mysql.com//mysql57-community-release-el6-8.noarch.rpmyum localinstall mysql57-community-release-el6-8.noarch.rpmvi /etc/yum.repos.d/mysql-community.repo第1步、yum安装mysql\[root@stonex ~\]# yum -y install mysql-server转载 2020-08-05 16:56:24 · 80 阅读 · 0 评论 -
mysql 查哪些表建了唯一索引
select a.table_id,a.name,b.name,b.type from information_schema.INNODB_SYS_TABLES a left outer join information_schema.INNODB_SYS_INDEXES b on a.table_id=b.table_id and b.type in (2)where a.name like...原创 2018-06-02 14:10:09 · 2552 阅读 · 0 评论 -
mysql存储过程和计划任务【集群下,计划任务的执行控制】
DROP PROCEDURE IF EXISTS `p_test_cluster`;DELIMITER ;;CREATE PROCEDURE `p_test_cluster`()BEGIN DECLARE iState INTEGER DEFAULT 0; select running_state into iState from tb_sys_task where job_...原创 2018-10-29 18:27:00 · 238 阅读 · 1 评论 -
MySQL一个字段存储另外一个表多个id
select t.name,t.ats_id,a.id, a.name from tb_m t ,tb_u awhere concat(";",t.ats_id,";") REGEXP(concat(";",a.id,";")) and a.id = 1111 order by t.id,a.id前提的数据结构:tb_m (id,name,ats_id)tb_u(id,name...原创 2019-01-08 14:01:17 · 1816 阅读 · 0 评论 -
Oracle 实现与mysql中find_in_set函数的兼容
https://blog.csdn.net/weixin_33757911/article/details/87512788find_in_set(str,strList),寻找str在strList中的位置。sql代码:-- 返回结果为1, SELECT FIND_IN_SET('1','1,2,3') FROM DUAL; sql代码:-- 返回结果...转载 2019-07-31 10:37:01 · 305 阅读 · 0 评论 -
mysql truncate table
truncate table tb_log等价于delete from tb_log;alter table tb_log auto_increment= 1;原创 2019-08-20 09:34:01 · 2032 阅读 · 0 评论 -
MySQL实现Oracle的 rownumber over
select * from ( select @rownum:=@rownum+1, if(@puid=base_tmp.user_id, @rank:=@rank+1,@rank:=1) as no, @puid:=base_tmp.user_id, base_tmp.* from (select * from tb_record where user...原创 2019-08-20 15:56:49 · 223 阅读 · 0 评论 -
MySQL一个字段做一对多关联
SELECT * from t_user a ,t_role bwhere b.role_id REGEXP concat('^',a.roles,'$')select * from t_role b where b.role_id REGEXP (select concat('^',roles,'$') from t_user where user_id = 1)以上两个SQL都是返回两条记录...原创 2018-06-15 16:28:54 · 1385 阅读 · 0 评论 -
MySQL正则查询
下面的意思是用户名和备注中,任意一个字段包括“测试”或者“比对”select * from userwhere user_name REGEXP '测试|比对' or user_remark REGEXP '测试|比对'原创 2018-06-07 14:50:15 · 334 阅读 · 0 评论 -
java+mysql中文乱码
1,创建数据库时字符集是utf8,创建表字符集是utf8,字段的字符集也是utf82,连接地址也有utf83,最后,数据库的配置还得是utf8才行(真心不习惯这种配置)create database brkcbase character set utf8 collate utf8_general_ci;[mysqld] ndbcluster# Options for da原创 2016-08-25 17:45:14 · 206 阅读 · 0 评论 -
SpringMVC页面向Controller提交数组+Mybatis传多个参数+MySQL一次写入多条记录
DAO层定义int insertRole2Authorities(@Param("roleId")int roleId, @Param("authorities")List authId);XML文件: insert into tm05_roles_authorities (role_id,authority_id) values原创 2016-10-09 13:17:35 · 2325 阅读 · 0 评论 -
MySQL NDB Cluster 7.5 / ... / Adding NDB Cluster Data Nodes Online: Detailed Example
MySQL Cluster原文,供参考Adding NDB Cluster Data Nodes Online: Detailed ExampleIn this section we provide a detailed example illustrating how to add new NDB Cluster data nodes on转载 2017-05-16 16:59:34 · 353 阅读 · 0 评论 -
MySQL Cluster (五) --- 动态增加数据节点配置步骤
原文地址http://blog.csdn.net/chengfei112233/article/details/7706275系统:Centos6.1mysql软件:mysql-cluster-gpl-7.2.6-linux2.6-x86_64.tar.gz集群具体配置请参考前一篇文章 3台机器搭建集群环境一. 原始集群配置如下(3台机器)转载 2017-05-16 17:00:51 · 1275 阅读 · 0 评论 -
Mysql Cluster水平扩展-添加数据节点
原文地址http://blog.csdn.net/yabingshi_tech/article/details/47953109一:实验环境 已搭建好MySQL cluster(一个管理节点,2个sql节点及2个数据节点),搭建步骤请参考:http://blog.csdn.net/yabingshi_tech/article/details/47952135,现要转载 2017-05-16 17:06:22 · 881 阅读 · 0 评论 -
windows下面部署MySQL Cluster7.4/7.5
下载MySQL Cluster 7.5.6的zip压缩包.实际使用过程中,遇到的问题1WARNING -- Failed to allocate nodeid for NDB at 192.168.1.7. Returned error: 'No free node id found for ndbd(NDB).'1.7是后面追加的数据节点,最初节点编号是从1到5.看原创 2017-05-16 17:17:55 · 1609 阅读 · 0 评论 -
MySQL分页查询偏移量问题
如果偏移量大于1000,返回速度较慢,如select * from t_pass where hm like 'B%' order by sj asc limit 1210,10;如何避免,翻页时连续翻页,一页一页的翻,如select * from t_pass where hm like 'B%' order by sj asc limit 1200,10;然后再原创 2017-07-28 16:40:51 · 4768 阅读 · 0 评论 -
Mysql Insert Or Update灵活使用
Oracle的计划任务job,每次看job的消息,能看到上次执行时间,下次执行时间,执行了多少次,,,等等信息可是MySQL的看不到这些信息,通过Navicat只能看到最初的定义信息,看着实在难受,都不知道是否执行了任务.实际使用中,计划任务执行存储过程,存储过程更新数据这样来定义存储过程DELIMITER //DROP PROCEDURE IF EXISTS p_vehicle_alarm_c...原创 2018-04-13 10:02:28 · 16831 阅读 · 0 评论 -
mysql设置定时任务
转自:https://www.cnblogs.com/laowu-blog/p/5073665.html今天遇到了个需要每天定时执行的任务,在mysql数据库里面提供了这样的功能,正好整理下分享出来。1.首先检查是否开启了定时任务123456查看event是否开启 : SHOW VARIABLES LIKE '%event_sche%';将事件计划开启 : SET GLOBAL event_sch...转载 2018-04-13 10:03:53 · 168 阅读 · 0 评论 -
ERROR 1130 (HY000): Host '10.117.1.13' is not allowed to connect to this MySQL server
C:\Documents and Settings\Administrator>e:\mysql\bin\mysql -u brkc -h 192.169.0.2 -pEnter password: ****ERROR 1130 (HY000): Host '192.169.0.2' is not allowed to connect to this MySQL server原创 2015-06-30 13:45:31 · 776 阅读 · 0 评论