
mysql
最后冰吻free
不在沉默中死亡,就在沉默中爆发
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
mysql ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
win10 ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES) 创建mysql-password.txt, 用于重置root密码,内容为:ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘123456’; 执行如下命令 mysqld --defaults-file="D:\\soft\\mysql-8.0.27-winx64\\my.ini" --ini原创 2021-12-23 19:26:02 · 795 阅读 · 0 评论 -
mysql创建定时器
//创建定时器每隔5s向表中插入一条记录 drop table if exists event_test; create table event_test( id int not null auto_increment, update_tm timestamp, create_tm timestamp, primary key(id) ); drop event if EXISTS timer_event; delimiter // create event timer_event on sch原创 2021-03-20 13:15:40 · 473 阅读 · 0 评论 -
mysql 知识点
设置序列的开始 1.drop table tbl_nm; create table tbl_nm( id int unsigned not null auto_increment, )engine=innodb auto_increment=100 default charset=utf8; 2.alter table tbl_nm auto_increment=200; 创建临时表 create TEMPORARY table temp_test ( id int unsigned not nul..原创 2020-09-03 11:28:59 · 648 阅读 · 0 评论 -
mysql 慢查询
查看慢查询日志是否开启 SHOW VARIABLES LIKE ’ %slow_query_log%’ ; 未开启,则set global slow_query_log=on;或修改my.cnf中新增slow_query_log = 1 查询慢查询时间 SHOW VARIABLES LIKE ’ long_query_time%’ ; 修改慢查询时间 set global long_query_time=3; 若无效,则在my.cnf文件中新增 long_query_time=..原创 2020-08-30 21:26:40 · 122 阅读 · 0 评论 -
mysql 主从配置
mysql 主从配置 master 1.cd /etc/my.cnf #mysql服务ID,保证mysql集群环境中唯一 server-id=1 #mysql二进制日志文件存放路径和文件名称 log-bin=/var/lib/msyql/mysqlbin #该节点读写状态,1-只读,0-读写 read-only=0 #忽略需要参与主从备份的库 binlog-ignore-db=mysql service mysql restart 2.创建同步数据的账户,并且进行授权操作。在主库主机的用户,主要用于I/Ot原创 2020-07-06 16:20:31 · 188 阅读 · 1 评论 -
mysql 重置root密码
vi /etc/my.cnf [mysqld] #添加跳过验证 skip-grant-tables 2.执行:systemctl restart mysqld.service 3.执行:mysql mysql>use mysql; mysql>update user set authentication_string=PASSWORD(‘123456’) where User=‘root’; mysql>flush privileges; 4.systemctl restart mys.原创 2020-07-02 14:31:41 · 187 阅读 · 0 评论 -
mysql count聚合函数性能
count(*)、count(主键id) 和 count(1) 都表示返回满足条件的结果集的总行数; 而count(字段),则表示返回满足条件的数据行里面,参数“字段”不为 NULL 的总个数。 性能差别 server 层要什么就给什么; InnoDB 只给必要的值; 现在的优化器只优化了 count(*) 的语义为“取行数”,其他“显而易见”的优化并没有 做。 对于 count(主键 id) 来说,InnoDB 引擎会遍历整张表,把每一行的 id 值都取出来,返回给 server 层。server 层原创 2020-06-17 15:47:53 · 191 阅读 · 0 评论 -
mysql 隔离级别概念
1.原子性:事物操作不可再分割,执行要么是成功的,要么是失败的即回滚, 回滚操作不会影响到数据库; 2.一致性:事物对数据库的操作从一个一致性状态转换为另一个一致性状态, 事物执行前后都是出于一致性状态; 3.隔离性:对一个表会出现并发操作时,事物之间是相互不干扰的; 4.持久性:一个事物一旦成功提交后,对数据库中数据的改变是永久性的,保存的文件中; 隔离级别 1.读未提交:事物A对数据进行修改,...原创 2020-06-16 16:58:54 · 290 阅读 · 0 评论 -
mysql 触发器简单应用
after/before表记录操作之后还是之前记录到日志表 CREATE TABLE `tbl_student0101` ( `name` char(20) DEFAULT NULL, `age` int(11) DEFAULT NULL, `tel` char(11) NOT NULL, PRIMARY KEY (`tel`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; #触发器日志表 drop table if exists student001_l原创 2020-06-04 18:41:26 · 170 阅读 · 0 评论 -
mysql 性能优化
转http://www.360doc.com/content/16/1203/12/33315109_611527150.shtml转载 2020-05-22 14:42:59 · 201 阅读 · 0 评论 -
mysql 存储过程批量更新
若表数据比较大,直接update会时间很慢,造成锁表,内存不够等问题,可以使用存储过程分批次进行更新提交,where条件最好加上索引,当然也可以批次删除; drop procedure if exists upt_tbl_nm; delimiter // create procedure upt_tbl_nm() begin declare ncnt int default 0; ...原创 2020-01-14 19:23:11 · 967 阅读 · 0 评论 -
mysql存储过程基础知识
cursor游标应用 select * from tbl_student0101; drop procedure if exists crt_std; delimiter // create procedure crt_std() BEGIN declare std_nm char(20); declare std_age int; declare std_tel char(11); d...原创 2019-11-06 17:18:53 · 193 阅读 · 0 评论 -
mysql 实现查询结果中每行添加伪列sql语句
select @rownum:=@rownum+1 as rownum, <表名>.* from (select @rownum:=0) temp, <表名>原创 2018-05-25 16:42:57 · 3016 阅读 · 0 评论 -
mysql mysqldump备份表脚本
#!/bin/bash #对mysql数据库进行制定数据库表备份 #$1: 0-备份,1-表恢复 #$2: 数据库 #$3: 表名 #$4: 表名 #... menu_func() { cat <<EOF `echo "=============================="` `echo -e "1、ip:192.168.0.23, port:6...原创 2018-05-23 18:53:21 · 656 阅读 · 0 评论 -
mysql ASCII '\0' appeared in statement
mysql 执行sql文件时报:Warning: Using a password on the command line interface can be insecure. ERROR at line 2104889: ASCII ‘\0’ appeared in the statement, but this is not allowed unless option –binary-mo...原创 2018-06-07 17:16:05 · 3323 阅读 · 0 评论 -
mysql cursor游标简单使用
drop procedure if exists cursor_test; #mysql默认遇到";"就会执行语句,存储过程中有";"但不想执行语句,则可以定义"//"、"??"等 delimiter // create procedure cursor_test() begin #申明表中的几个字段变量(对应表字段类型相同)用于存储查数据原创 2018-06-26 16:08:19 · 2076 阅读 · 3 评论 -
mysql 表数据导入导出
mysql表数据到出 select * into oufile '/path/file_name' fields terminated by '|' enclose by '"' from tbl1; fields terminated by ‘|’:字段分割符 fields enclose by ‘”’:字段值由”符包起来 fields OPTIONALLY enclose ...原创 2018-08-16 15:48:16 · 303 阅读 · 0 评论 -
mysql MyISAM和InnoDb存储引擎
1.show variables like ‘table_type’ 2.show create table tbl_nm;/* 查看创表语句 */ 存储引擎 1.MyISAM: 默认mysql存储引擎,不支持事务、也不支持外键,其优势是访 问的速度快,对事务完整性没有要求或者以 SELECT、INSERT 为主的应用基本上都可以使用 这个引擎来创建表 文件格式: 每个 MyISAM 在磁盘上存储...原创 2018-10-31 17:15:27 · 262 阅读 · 0 评论 -
mysql 对表中指定字段值按指定顺序排序
select * from tbl_sutdent where age in (20, 25, 30) order by field(`age`, 30, 20, 25);原创 2019-01-10 17:38:04 · 2890 阅读 · 0 评论 -
mysql 存储过程创建一年表
drop PROCEDURE if EXISTS create_table; delimiter // create procedure create_table() begin declare date_end date; declare date_tmp date; declare str_sql varchar(4000); declare sql_...原创 2019-06-14 10:57:11 · 893 阅读 · 0 评论 -
mysql 报ERROR 1840 (HY000) at line 24: @@GLOBAL.GTID_PURGED can only be set when @@GLOBAL.GTID_EXECUT
转载https://www.cnblogs.com/tonnytangy/p/7779164.html转载 2018-05-11 16:13:49 · 1774 阅读 · 0 评论