spring boot设定mysql

时间:2017-04-16 20:11:27   收藏:0   阅读:288

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

原文:http://www.cnblogs.com/zhao1949/p/6719674.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!