![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
MySQL
longgggggggggggggggg
这个作者很懒,什么都没留下…
展开
-
解决pymysql.err.OperationalError: (1040, ‘Too many connections‘)
解决pymysql.err.OperationalError: (1040, ‘Too many connections‘)原创 2022-10-13 11:44:37 · 487 阅读 · 0 评论 -
mysqldump: Got error: 1556: “You can‘t use locks with log tables“ when using LOCK TABLES最简单的解决办法
mysqldump加上--lock-tables=0这个参数,不锁表备份,也是可行的。原创 2022-07-19 14:56:33 · 306 阅读 · 0 评论 -
MySQL mysqldump数据导出详解
MySQL mysqldump数据导出详解原创 2022-07-15 14:45:28 · 6925 阅读 · 4 评论 -
Centos7 下定义MariaDB源Yum安装最新版本的MariaDB
Centos7 下定义MariaDB源Yum安装最新版本的MariaDB在Centos下安装软件服务的方式一般就那么几种(yum、rpm ivh xxx、make make&&install编译安装等),但是相对yum是最简单的也是最容易的。我们今天主要介绍,在Centos7.3下如何使用yum方式安装最新版本或者执行版本的MaraDB,我们都知道,从Centos7开始已经从MySQL变成了MariaDB了,具体就不多介绍了,估计很多同学已经尝试过了,如果使用yum install mariadb-serv原创 2022-06-22 15:29:44 · 846 阅读 · 0 评论 -
CentOS7 Mariadb 数据库初始化 “mysql_secure_installation未找到命令”的处理
CentOS7 Mariadb 数据库初始化 “mysql_secure_installation未找到命令”的处理[root@localhost ~]# mysql_secure_installation-bash: mysql_secure_installation: 未找到命令出现这种情况,请将命令修改为:mariadb-secure-installation...原创 2022-06-22 15:16:46 · 1707 阅读 · 0 评论 -
mysql replace替换
mysql replace替换:UPDATE tb1 SET `field_name`=REPLACE(`field_name`, 'from_str', 'to_str');原创 2022-02-21 17:18:33 · 466 阅读 · 0 评论 -
mysql 查询某个字段值重复的所有数据
查询出cutover_id 重复的所有数据SELECT * from cutover_cut_sure where cutover_id in (SELECT cutover_id from cutover_cut_sure GROUP BY cutover_id HAVING count(*)>1)原创 2022-02-18 14:04:40 · 649 阅读 · 0 评论 -
MySql查询字段为null的记录
MySql查询字段为null的记录select * from table where fieldValue is null原创 2022-01-24 10:53:15 · 1059 阅读 · 0 评论 -
MySQL 联合查询及时间戳转化
MySQL 联合查询及时间戳转化:SELECT M21_alert.`customer_ip`,M21_assets.customer_name,M21_assets.device_area,FROM_UNIXTIME(M21_alert.alert_timestamps,'%Y-%m-%d %H:%i:%s') AS alert_timestamps,M21_alert.trigger_description,M21_alert.alert_comment,FROM_UNIXTIME(M21_aler原创 2021-12-09 10:30:56 · 468 阅读 · 0 评论 -
解决ERROR 1709 (HY000) at line 939: Index column size too large. The maximum column size is 767 bytes.
解决mysql报错:ERROR 1709 (HY000) at line 939: Index column size too large. The maximum column size is 767 bytes.三个步骤如下:set global innodb_large_prefix='ON';set global innodb_file_format='Barracuda';set global innodb_file_per_table='ON';...原创 2021-11-10 14:39:50 · 2028 阅读 · 0 评论 -
Centos7下mariadb忘记root密码处理
1,停止mariadb服务systemctl stop mariadb2,修改配置文件 vim /etc/my.cnf在[mysqld]下添加skip-grant-tables意思是忽略密码, 保存并退出3,启动Mariadbsystemctl start mariadb4,修改密码mysqluse mysql;UPDATE user SET Password = password ( ‘new-password’ ) WHERE User = ‘root’ ;flush privil原创 2021-10-22 15:26:07 · 383 阅读 · 0 评论 -
MySQL中时间戳转时间
FROM_UNIXTIME(process_timestamps,’%Y-%m-%d %H:%i:%s’) AS process_time原创 2021-10-14 11:33:05 · 1197 阅读 · 0 评论 -
MySQL 联合查询
SELECT M21_alert.`customer_ip`,M21_assets.customer_name,M21_assets.device_area,M21_alert.alert_timestamps,M21_alert.trigger_description,M21_alert.alert_comment,M21_alert.upgrade_timestamps,M21_alert.`alert_duration`,M21_alert.`feedback_status`,M21_alert.`原创 2021-10-14 11:01:40 · 58 阅读 · 0 评论 -
MySQL联表查询
SELECT a.`name`,a.local_graph_id,a.customer_service,a.pact_id,a.pact,a.wpid,a.`order`,a.`minimum`,b.`port`,b.rrdpath,b.area,b.type FROM (select `name`,local_graph_id,customer_service,pact_id,pact,wpid,`order`,`minimum` from customer whe原创 2021-10-14 10:10:45 · 53 阅读 · 0 评论 -
Linux:CentOS7卸载mysql
Linux:CentOS7卸载mysql </h1> <div class="clear"></div> <div class="postBody"> <div id="cnblogs_post_body" class="blogpost-body blogpost-body-html">步骤方法一、1.查看mysql安装rpm...原创 2021-08-20 17:36:10 · 101 阅读 · 0 评论 -
给某个IP地址段开通MySQL访问权限:
给某个IP地址段开通MySQL访问权限:1、MySQL授权GRANT ALL PRIVILEGES ON *.* TO 'root'@'120.120.120.%' identified by 'xxxxxx' WITH GRANT OPTION;2、开通防火墙:firewall-cmd --zone=public --add-rich-rule="rule family="ipv4" source address="120.120.120.0/24" port protocol="tcp" po原创 2021-07-02 11:06:48 · 588 阅读 · 0 评论 -
mysql数据表复制命令
mysql数据表复制命令:create table new_customer select * from customer;原创 2021-03-17 16:56:24 · 234 阅读 · 0 评论 -
使用rename table
使用rename tablerename table table1 to new_table;这里的sql语句会将table1 重命名为new_table原创 2021-03-17 16:25:24 · 347 阅读 · 0 评论 -
mysql联表去重查询
mysql联表去重查询:SELECT DISTINCT a.* FROM (select * from customer where disabled=0) a RIGHT JOIN (SELECT * FROM customer_port WHERE area='华北-17' and disabled=0 and update_time>'2021-01-21') b原创 2021-01-22 09:28:27 · 1697 阅读 · 0 评论 -
MySQL DISTINCT:去重(过滤重复数据)
MySQL DISTINCT:去重(过滤重复数据)SELECT DISTINCT customer_name FROM all_customer原创 2020-09-21 14:35:12 · 159 阅读 · 0 评论 -
navicat操作mysql中某一张表后, 读表时一直显示正在载入,卡死不动,无法操作
首先执行:show full processlist; //列出当前的操作process,一般会看到很多waiting的process,说明已经有卡住的proces了,我们要杀死这些process!!再执行:查看status是否有ID被锁,如果被锁,杀死ID,kill ID;kill processid; //processid表示process的id,比如kill 3301,就会将id为3301的process杀死。使用 kill 将所有的 id 杀死。然后重启MySQL,一般就会解决了。转载 2020-07-25 01:08:39 · 2135 阅读 · 0 评论 -
Error【1146】:Table 'xxx.xxx' doesn't exist问题原因及解决方法
https://blog.csdn.net/GX_1_11_real/article/details/81347343?depth_1-utm_source=distribute.pc_relevant.none-task&utm_source=distribute.pc_relevant.none-task转载 2020-02-27 00:31:49 · 3200 阅读 · 0 评论 -
navicat 远程连接不上mysql 解决办法
navicat 远程连接不上mysql 解决办法 从以下方面寻找解决方案 1 查看mysql的端口 show global variables like 'port'; 查看是不是3306端口2 查看用户是否允许远程登录 use mysql; select user,host from user; 返回结果查看指定用户是locaho...原创 2020-02-22 22:11:39 · 151 阅读 · 0 评论 -
自定义数据库模块及调用
class DB(object): def __init__(self,dbn="mysql",user="",pw="",host="",db=""): self.dbn=dbn self.user=user self.pw=pw self.host=host self.db=db def query...原创 2019-12-05 11:18:22 · 172 阅读 · 0 评论 -
如何删除mysql 主键索引
如果一个主键是自增长的,不能直接删除该列的主键索引,应当先取消自增长,再删除主键特性alter table 表名 drop primary key; 【如果这个主键是自增的,先取消自增长.】具体方法如下:alter table articles modify id int ;【重新定义列类型】alter table articles drop primary key;...原创 2019-06-06 09:31:24 · 3483 阅读 · 0 评论 -
给MySQL中某表增加一个新字段,设为主键值为自动增长。
alter table test_tb add ID int(10) primary key AUTO_INCREMENT;设定完成后,原有记录的该字段会增加并自动设上值。以后的值会在已有记录的最大值基础上递增出来。...原创 2019-06-06 09:27:41 · 2616 阅读 · 0 评论 -
MySQL给一个字段递增赋值
首先设置一个变量,初始值为0:set @r:=0;1然后更新表中对应的ID列:update tablename set id=(@r:=@r+1)1如果是插入,那就找一个记录多的表t1set @r:=0;insert into t select @r:=@r+1 from t1 limit 0, 200012@完 ...原创 2019-05-28 09:51:55 · 1023 阅读 · 0 评论 -
查询数据库中数据重复的mysql语句
select cert_url,count(*) as count from myantirust_not_acquired_cert group by cert_url having count>1;查询结果:原创 2019-04-25 12:08:57 · 457 阅读 · 0 评论 -
查询mysql数据库中某个表存储数据的大小
select concat(round(sum(data_length/1024/1024),2),'MB') as data_length_MB, concat(round(sum(index_length/1024/1024),2),'MB') as index_length_MB from information_schema.tables where table_schem...原创 2019-04-28 14:45:35 · 405 阅读 · 0 评论 -
mySQL创建表时添加表和列的注释,以及查看表和列的注释
CREATETABLE groups( gidINTPRIMARY KEY AUTO_INCREMENT COMMENT '设置主键自增', gnameVARCHAR(200) COMMEN...原创 2019-06-06 09:35:46 · 731 阅读 · 0 评论 -
mysql大小写敏感配置
1.mysql大小写敏感配置mysql大小写敏感配置相关的两个参数,lower_case_file_system 和 lower_case_table_names。查看当前mysql的大小写敏感配置show global variables like ‘%lower_case%’;±-----------------------±------+| Variable_name ...原创 2019-06-14 16:18:06 · 5559 阅读 · 0 评论 -
外键约束问题:django.db.utils.IntegrityError: (1215, ‘Cannot add foreign key constraint‘)
[外键约束问题]django.db.utils.IntegrityError: (1215, 'Cannot add foreign key constraint')DATABASES= { 'default': { 'ENGINE': 'django.db.backends.my...原创 2019-06-26 15:59:59 · 2103 阅读 · 0 评论 -
问题描述: django.db.utils.OperationalError: (1366, "Incorrect string value: '\xE9\x9B\x86\xE6\x8E\xA7' f
问题描述: django.db.utils.OperationalError: (1366, “Incorrect string value: ‘\xE9\x9B\x86\xE6\x8E\xA7’ for column ‘name’ at row 1”)数据库字符集问题,如mysql将字符集设置为utf8或utf8mb4即可...原创 2019-07-08 11:39:23 · 736 阅读 · 0 评论 -
SQL查询~ 存在一个表而不在另一个表中的数据
A、B两表,找出ID字段中,存在A表,但是不存在B表的数据。A表总共13w数据,去重后大约3W条数据,B表有2W条数据,且B表的ID字段有索引。方法一 使用 not in ,容易理解,效率低&nb...原创 2019-07-25 10:29:36 · 293 阅读 · 0 评论 -
查询MySQL数据库中表中数据占用从的内存大小的命令
select concat(round(sum(data_length/1024/1024),2),‘MB’) as data_length_MB,concat(round(sum(index_length/1024/1024),2),‘MB’) as index_length_MBfrom information_schema.tableswhere table_schema=‘数据库名称...原创 2019-04-22 09:58:02 · 2104 阅读 · 0 评论