Windows 安装 MySQL8 版本
之前本地只安装了 MySQL 5.7 的版本,现在需要再安装一个 MySQL 8 版本。并同时运行两个 MySQL 实例。
之前本地只安装了 MySQL 5.7 的版本,现在需要再安装一个 MySQL 8 版本。并同时运行两个 MySQL 实例。
在项目中,有部分数据是以 JsonObject 和 JsonArray 的形式直接存储在 MySQL 中的。
如果想对 这部分数据进行查询 等操作,非常不便。
经查询,MySQL 5.7.8 新增了对 Json 数据的相关支持,MySQL 8.0.4 新增了 Json 表函数的功能。
通过使用 内置的 函数,可以非常方便的对以 JsonObject 和 JsonArray 的形式直接存储在 MySQL 中的字段,进行查找、排序等操作。
本文总结了 MySQL 对 Json 操作的相关用法。
tomcat 运行时,报如下异常:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/Jueee/.m2/repository/org/slf4j/slf4j-log4j12/1.7.21/slf4j-log4j12-1.7.21.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/Jueee/.m2/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.13.3/log4j-slf4j-impl-2.13.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError.
SLF4J: See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.
26-May-2021 18:44:40.531 严重 [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file
26-May-2021 18:44:40.531 严重 [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Context [/adminWeb] startup failed due to previous errors
26-May-2021 18:44:40.545 警告 [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [adminWeb] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Object.wait(Native Method)
java.lang.Object.wait(Object.java:502)
java.util.TimerThread.mainLoop(Timer.java:526)
java.util.TimerThread.run(Timer.java:505)
maven 打包项目时出现如下问题:
[ERROR] Failure executing javac, but could not parse the error:
致命错误: 在类路径或引导类路径中找不到程序包 java.lang
Python 示例:
import os
val = os.system('ls -al')
print val
正常输出的情况下,sh 返回的状态码是 0
$ python test1.py
total 12
drwxr-xr-x 2 jue root 4096 May 25 11:18 .
drwx------ 4 jue root 4096 May 25 11:18 ..
-rw-r--r-- 1 jue root 46 May 25 11:18 test1.py
0
没有找到时,sh 返回的状态码是 1,而适用 Python 调用,返回的是:256
import os
val = os.system('ls -al|grep jue')
print val
调用 Python
$ python test1.py
256
有三个方法可以使用:
subprocess 模块允许创建很多子进程,创建的时候能指定子进程和子进程的输入、输出、错误输出管道,执行后能获取输出结果和执行状态。
# -*- coding: utf-8 -*-
import datetime
if __name__=='__main__':
today = datetime.datetime.today()
yesterday = today - datetime.timedelta(days=1)
keyWord = yesterday.strftime( '%Y-%m-%d' )
print(keyWord +" 测试!")
#! /bin/bash
thispath=$(cd "$(dirname "$0")"; pwd)
pyfile="$thispath/test.py"
result=`python $pyfile`
echo $result >> $thispath/out.log
$ ./runAlarm.sh
2021-05-24 测试!
# -*- coding: utf-8 -*-
import sys
if __name__=='__main__':
print("param one:"+sys.argv[1])
print("param two:"+sys.argv[2])
运行脚本:
$ python test0.py a b
param one:a
param two:b
#! /bin/bash
thispath=$(cd "$(dirname "$0")"; pwd)
pyfile="$thispath/test0.py"
result=`python $pyfile ttt ccc`
echo $result
运行结果:
param one:ttt param two:ccc
向 Shell 脚本传递参数:
#! /bin/bash
thispath=$(cd "$(dirname "$0")"; pwd)
pyfile="$thispath/test0.py"
result=`python $pyfile $1 $2`
echo $result
运行结果:
$ bash test0.sh aaa bbb
param one:aaa param two:bbb