当前位置:Gxlcms > 数据库问题 > spring boot设定mysql

spring boot设定mysql

时间:2021-07-01 10:21:17 帮助过:21人阅读

mysql创建表,制定自增,utf-8编码

create table person
(id int auto_increment primary key,
 name varchar(100), age int, address varchar(100))
 default charset utf8;
 
 
 mysql依赖
 
 <dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
 </dependency>
 
 application.properties
 mysql乱码解决,制定连接子串utf-8
 
spring.datasource.url=jdbc:mysql://localhost:3306/test?characterEncoding=UTF-8
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.username=user
spring.datasource.password=password

spring boot设定mysql

标签:arch   auto   ima   jdbc   name   cto   子串   spring   host   

人气教程排行