一、ubuntu安装数据库
安装:
sudo apt-get install mysql-server
查看版本:mysql -V
查看运行状态:sudo netstat -tap | grep mysql
cd /etc/mysql
sudo vim debian.cnf
mysql -u debian-sys-maint -p
Enter password: xxxxxxxxxxxxxxxx
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'xxxxxx';
use mysql;
select host,user from user;
update user set host = '%' where user = 'root';
flush privileges;
勾选mybatis、jdbc等依赖。
2.修改application.properties配置文件
可以将这个文件拆成三个,一个是选择启动文件的application.yml,一个是开发环境application-dev.yml,一个是生产环境application-prod.yml,生产环境的url将localhost替换成远程数据库地址,详细如下:
spring:
profiles:
active: prod
server:
port: 8080
spring:
datasource:
username: root
password: 123456
url: jdbc:mysql://82.157.160.30:3306/ache?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=UTC
driver-class-name: com.mysql.cj.jdbc.Driver
mybatis:
mapper-locations: classpath:mapping/*Mapper.xml
type-aliases-package: com.example.demoMybatis.entity
#showSql
logging:
level:
com:
example:
mapper: debug
mapper
数据库:
测试一下:
常规打包mvn clean package、
常规上传、查找容器docker ps
、查找镜像docker images
、kill容器docker kill CONTAINERID
、移除容器docker rm CONTAINERID
、移除镜像docker rmi IMAGEID
、构建镜像docker build -t my/demo .
、运行容器docker run -d --name demo -p 8080:8080 my/demo
const highLight = (allText, keyword) => {
let Reg = new RegExp(keyword, "ig");
if (allText) {
let execRes = Reg.exec(allText.toString()); //得到一个匹配结果的集合,包含关键字出现的索引
if (execRes) {
let realword = allText.substr(execRes.index, keyword.length); //根据索引和关键字长度获取原本的真实大小写关键词
let res = allText.replace(
Reg,
`<span style="color: red;">${realword}</span>`
);
return res;
} else return allText;
} else return allText;
};
<h3 v-html="highLight(item.title, filter.search)"></h3>
<p v-html="highLight(item.detail, filter.search)"></p>