码迷,mamicode.com
首页 > 数据库 > 详细

项目中mybatis连接mysql常见问题

时间:2019-01-14 14:46:38      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:failure   url   特殊   mysql8   time   uil   using   The   rate   

参考:https://blog.csdn.net/qq_40943363/article/details/82633906 
 

1.pom.xml文件中指定的generatorConfig.xml文件路径不对

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.343 s
[INFO] Finished at: 2018-09-11T21:50:29+08:00
[INFO] Final Memory: 13M/115M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.2:generate (default-cli) on project springboot-mybatis: configfile XXX\src\main\java\generator\generatorConfig.xml does not exist -> [Help 1]

 

2.generatorConfig.xml文件中的数据库驱动路径写错 

<classPathEntry location="/Users/xxx/.m2/repository/mysql/mysql-connector-java/5.1.30/mysql-connector-java-5.1.30.jar"/>

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.189 s
[INFO] Finished at: 2018-09-11T22:23:34+08:00
[INFO] Final Memory: 14M/115M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.2:generate (default-cli) on project springboot-mybatis: Execution default-cli of goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.2:generate failed: Cannot resolve classpath entry: C:\Users\Administrator\.m2\repository\mysql\mysql-connector-java\5.2.46\mysql-connector-java-5.1.46.jar -> [Help 1]

 3.generatorConfig.xml文件中的连接数据账号密码写错  

<!--mysql数据库连接-->
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/test" 
userId="root"
password="password"/>

  

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.250 s
[INFO] Finished at: 2018-09-11T22:30:42+08:00
[INFO] Final Memory: 16M/115M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.2:generate (default-cli) on project springboot-mybatis: Access denied for user ‘root‘@‘localhost‘ (using password: YES) -> [Help 1]

 

4.pom.xml文件中的没有添加mybatis插件

<plugins>
<plugin>
    <groupId>org.mybatis.generator</groupId>
    <artifactId>mybatis-generator-maven-plugin</artifactId>
    <version>1.3.2</version>
    <configuration>
        <!--mybatis用于生成代码的配置文件-->
        <configurationFile>src/main/resources/generatorConfig.xml</configurationFile>
        <verbose>true</verbose>
        <overwrite>true</overwrite>
    </configuration>
</plugin>
</plugins>

 

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.913 s
[INFO] Finished at: 2018-09-11T22:37:47+08:00
[INFO] Final Memory: 26M/183M
[INFO] ------------------------------------------------------------------------

[ERROR] No plugin found for prefix ‘mybatis-generator‘ in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\Administrator\.m2\repository), central 

 

5. mysql8 :客户端连接caching-sha2-password问题 

参考:https://blog.csdn.net/u010026255/article/details/80062153
注意mysql新版本密码需要复杂些,要包含大写小写数字或者特殊符号 
ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘这里写密码‘ PASSWORD EXPIRE NEVER; #修改加密规则 
   
ALTER USER ‘root‘@‘localhost‘ IDENTIFIED WITH mysql_native_password BY ‘这里写密码‘; #更新一下用户的密码 

FLUSH PRIVILEGES; #刷新权限 

  

6.Mysql 8授权语句

create user ‘root@localhost‘ identified by ‘Password‘;

grant all privileges on *.* to ‘root@localhost‘;

  

 

 

项目中mybatis连接mysql常见问题

标签:failure   url   特殊   mysql8   time   uil   using   The   rate   

原文地址:https://www.cnblogs.com/Hangtutu/p/10266135.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!