1、首先登陆mysql,查看mysql的数据情况,select * from test_data1 t
2、新建java类,测试jdbc功能
3、编写java的jdbc代码,
String driver = "com.mysql.cj.jdbc.Driver"
String url = "jdbc:mysql://localhost:3306/testdb?characterEncoding=utf8&useSSL=false"
String user = "root"
String pwd = "123456"
4、代码中查询mysql数据表,并执行查出表中内容;select * from test_data1
mysql5.0
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/testspringboot?useSSL=false
mysql8.0
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/testspringboot?useSSL=false&serverTimezone=UTC
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)