Mysql 修改密码
步骤说明使用Navicat Premium 更改连接需要更改的库,点击用户
选择要更改的用户名,点击编辑或双击
出现如图页面,输入新密码保存即可
Mysql 更新Null值出现的事务失败的情况
步骤说明新接一个老项目,数据库设计中字段没有设置默认值
事务中出现了失败情况。debug 看到public_task_count字段为null 导致出现更新影响条数为0的情况。
解决办法
UPDATE `cd_member` SET `public_task_count` = `public_task_count` + 1WHERE `id` = 3
改为
UPDATE `cd_member` SET `public_task_count` = IFNULL(`public_task_count`,0) + 1 WHERE `id` = 3
RocketMQ 安装教程
步骤说明一键部署 docker-compose案例 版本 4.7.0
git clone https://github.com/foxiswho/docker-rocketmq.gitcd docker-rocketmqcd rmqchmod +x start.sh./start.sh
访问浏览器
localhost:8180
注意 如果你的微服务或者项目在开发的时候没有放入docker中或者与rocketmq容器不能直接用IP访问, 那么请把broker.conf中的 #brokerIP1=192.168.0.253 前面#号去掉,并且把后面的IP地址改成你的rocketmq容器宿主机IP地址, 否则报 com.alibaba.rocketmq.remoting.exception.RemotingConnectException: connect to 172.0.0.120:10909 failed 配置文件 在 rmq/rmq/brokerconf 目录下
注意事项因Centos 7 使用的是firewalld所以要开放相应的端口参考:RocketMQ 介绍与安装
根据 ...
ThinkPHP SQL查询骚操作
多个字段累加 & 更新多个字段inc$saveRes = Member::where('id', $memberId) ->inc('money', $changeAmount) ->inc('point', $changeNum) ->data(['status' => 1, 'update_time' => time()]) ->update();
原生$sql = 'UPDATE `cd_member`SET `point`=`point` + `add_point`, `total_point`=`total_point` + `add_point`, `week_point`=`week_point` + `add_point`, `add_point`=0 ...
SpringBoot使用mongoTemplate时注意事项
解决步骤更新整个对象使用save()
更新某个字段而不是整个对象请使用updateFirst()或者updateMulti(),而不是save()
问题说明项目开发过程中使用到了Spring Data操作Mongo
例:根据id更新sku数据
mongoTemplate.save(sku)
原文档{ "_id" : ObjectId("5ef9a63c1dd6b500c38eb784"), "product_id" : ObjectId("5ef952254538f17296470d6f"), "sku_attr_id" : ObjectId("5ef9a5c11dd6b500c38eb781"), "barcode": ["15134643623"], "rrp" : NumberDecimal("1588.00"), " ...
ThinkPHP与Redis组合处理延时任务
环境说明
ThinkPHP 6.0
Redis
PHP 7.4.11
Homestead
步骤说明安装 predis/predis 依赖注:安装该扩展目的详看:\think\cache\driver\Redis
if (extension_loaded('redis')) { $this->handler = new \Redis; if ($this->options['persistent']) { $this->handler->pconnect($this->options['host'], (int) $this->options['port'], (int) $this->options['timeout'], 'persistent_id_' . $this->options['select']); } else { ...
docker-compose 快速构建公司局域网DNS服务器
环境说明
Centos 7
docker-compose
192.168.50.100 为DNS服务器所在
192.168.50.101 为目的服务器
步骤说明编辑.env文件增加登录dns web 页账号密码配置############### Dns #################TZ=Asia/ShanghaiHTTP_USER=rootHTTP_PASS=root
在Docker主机上创建文件/dnsmasq.conf以下为内容跟github中的一致,这里只是做测试:
#dnsmasq config, for a complete example, see:# http://oss.segetech.com/intra/srv/dnsmasq.conf#log all dns querieslog-queries#dont use hosts nameserversno-resolv#use cloudflare as default nameservers, prefer 1^4server=1.0.0.1server=1.1.1.1strict-order#serve ...
Hello World
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
Quick StartCreate a new post$ hexo new "My New Post"
More info: Writing
Run server$ hexo server
More info: Server
Generate static files$ hexo generate
More info: Generating
Deploy to remote sites$ hexo deploy
More info: Deployment
Spring Boot 项目打包Docker镜像到Harbor
环境说明
Harbor 部署在192.168.2.105
步骤说明
引入 dockerfile-maven-plugin
<plugin> <groupId>com.spotify</groupId> <artifactId>dockerfile-maven-plugin</artifactId> <version>1.4.13</version> <executions> <execution> <id>default</id> <goals> <!--如果package时不想用docker打包,就注释掉这个goal <goal>build</goal> <goal>push</goal>--> ...
无题
环境说明步骤说明Java 加密引入 hutool
// 构建byte[] key = "ie4zTPBagxAG235tcoHKswVbmOYZDflI".getBytes();AES aes = SecureUtil.aes(key);// 加密String content = "加密内容";String encode = aes.encryptBase64(content);System.out.println(encode);// 解密byte[] decrypt = aes.decrypt(encode);System.out.println(new String(decrypt));
PHP 解密public function encrypt($data, $key){ $data = openssl_encrypt($data, 'AES-256-ECB', $key, OPENSSL_RAW_DATA); return base64_encode($data);}public fu ...