2022-10-12 21:30:33.820 ERROR 39252 --- [eate-2092870757] com.alibaba.druid.pool.DruidDataSource : create connection SQLException, url: jdbc:mysql://192.168.231.144:3306/gulimall_pms?useSSL=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC, errorCode 1045, state 28000 java.sql.SQLException: Access denied for user 'root'@'192.168.231.1' (using password: NO) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:827) at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:447) at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:237) at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199) at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1570) at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1636) at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2550) 2022-10-12 21:30:33.836 ERROR 39252 --- [eate-2092870757] com.alibaba.druid.pool.DruidDataSource : create connection SQLException, url: jdbc:mysql://192.168.231.144:3306/gulimall_pms?useSSL=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC, errorCode 1045, state 28000 java.sql.SQLException: Access denied for user 'root'@'192.168.231.1' (using password: NO) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:827) at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:447) at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:237) at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199) at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1570) at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1636) at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2550)
这个错误卡了俩天没有解决掉,网上看了看各种各样的方法,有的说的权限问题,需要修改权限,有的说是版本问题,但是后面看了各种各样的玩意还是没解决掉
这是我的配置文件
spring: datasource: username: root data-password: 123456 url: jdbc:mysql://192.168.231.144:3306/gulimall_pms?useSSL=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC driver-class-name: com.mysql.cj.jdbc.Driver mybatis-plus: mapper-locations: classpath:/mapper/**/*.xml global-config: db-config: id-type: auto
最后突发奇,直接粘贴下人人网的快速的配置文件进行修改,以为我人人网的能跑。
spring: datasource: type: com.alibaba.druid.pool.DruidDataSource druid: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://192.168.231.144:3306/gulimall_pms-?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai username: root password: 123456 initial-size: 10 max-active: 100 min-idle: 10 max-wait: 60000 pool-prepared-statements: true max-pool-prepared-statement-per-connection-size: 20 time-between-eviction-runs-millis: 60000 min-evictable-idle-time-millis: 300000 mybatis-plus: mapper-locations: classpath:/mapper/**/*.xml global-config: db-config: id-type: auto
发现可以跑了。
什么!!!!!!你问我为什么能跑了?还没心情搞。能跑就完了,可以进行下一步了
data-password: 123456
呃找到了,写成了这玩意
今日分享
通过标签<dependencyManagement>: 如: <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>1.4.1.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement>
注意:上述的type=pom意味着我们可以将所有的jar包打包成一个pom,然后我们依赖了pom,即可以下载下来所有依赖的jar包;scope=import代表从其它的pom中导入dependency的配置;