Home > Back-end >  Use mybatis - plus code generator times database account or password error exception
Use mybatis - plus code generator times database account or password error exception

Time:10-03

This is my code generator configuration code, I guarantee that the database account and password are right
 package the generator; 

The import com. Baomidou. Mybatisplus. Enums. IdType;
The import com. Baomidou. Mybatisplus. Generator. AutoGenerator;
The import com. Baomidou. Mybatisplus. Generator. Config. DataSourceConfig;
The import com. Baomidou. Mybatisplus. Generator. Config. GlobalConfig;
The import com. Baomidou. Mybatisplus. Generator. Config. PackageConfig;
The import com. Baomidou. Mybatisplus. Generator. Config. StrategyConfig;
The import com. Baomidou. Mybatisplus. Generator. Config. Rules. DbType;
The import com. Baomidou. Mybatisplus. Generator. Config. Rules. NamingStrategy;

/* *
* @ Title: MpGenerator
* @ Description: mybatis - plus code generator configuration
* @ author Hmoji
* @ date on March 29, 2020,
* @ time afternoon 10:20:18
*/
Public class MpGenerator {
Public static void main (String [] args) {
GlobalConfig gb=new GlobalConfig ();
Gb. SetAuthor (" Hmoji ")
SetBaseColumnList (true)
SetBaseResultMap (true)
SetFileOverride (true)
SetIdType (IdType. ID_WORKER_STR)
SetOutputDir (" E: \ \ git_repo \ \ supermarket \ \ SRC \ \ the main Java \ \ ");

DataSourceConfig db=new DataSourceConfig ();
Db. SetDbType (DbType. MYSQL)
SetDriverName (" com. Mysql. JDBC Driver ")
The setUrl (" JDBC: mysql://127.0.0.1:3306/supermarketmanage? UseSSL=false& amp; CharacterEncoding=utf-8 ")
SetUsername (" root ")
The setPassword (" 123456 ");

StrategyConfig st=new StrategyConfig ();
St. setCapitalMode (true)
. SetLogicDeleteFieldName (" flag ")
SetNaming (NamingStrategy. Underline_to_camel)
Tbl_ setTablePrefix (" ");

PackageConfig pk=new PackageConfig ();
Pk. SetParent (" com. Hmoji ");

AutoGenerator auto=new AutoGenerator ();
Auto. SetDataSource (db)
SetGlobalConfig (gb)
SetPackageInfo (pk)
SetStrategy (st);

Auto. The execute ();
}
}


Pop up the two abnormal
 22:37:22. 140 the DEBUG com. Baomidou. Mybatisplus. Generator. AutoGenerator 86 execute -==========================to generate the file...==========================
Java. SQL. SQLException: Access denied for user 'root' @ 'localhost' (using password: YES)
? At com. Mysql. JDBC. SQLError. CreateSQLException (SQLError. Java: 965)
At com. Mysql. JDBC. MysqlIO. CheckErrorPacket (MysqlIO. Java: 3978)
At com. Mysql. JDBC. MysqlIO. CheckErrorPacket (MysqlIO. Java: 3914)
At com. Mysql. JDBC. MysqlIO. CheckErrorPacket (MysqlIO. Java: 871)
At com. Mysql. JDBC. MysqlIO. ProceedHandshakeWithPluggableAuthentication (MysqlIO. Java: 1714)
At com. Mysql. JDBC. MysqlIO. DoHandshake (MysqlIO. Java: 1224)
At com. Mysql. JDBC. ConnectionImpl. CoreConnect (ConnectionImpl. Java: 2199)
At com. Mysql. JDBC. ConnectionImpl. ConnectOneTryOnly (ConnectionImpl. Java: 2230)
At com. Mysql. JDBC. ConnectionImpl. CreateNewIO (ConnectionImpl. Java: 2025)
At com. Mysql. JDBC. ConnectionImpl. & lt; init> (ConnectionImpl. Java: 778)
At com. Mysql. JDBC. JDBC4Connection. & lt; init> (JDBC4Connection. Java: 47)
The at Java. The base/JDK. Internal. Reflect. NativeConstructorAccessorImpl. NewInstance0 (Native Method)
The at Java. The base/JDK. Internal. Reflect. NativeConstructorAccessorImpl. NewInstance (NativeConstructorAccessorImpl. Java: 62)
The at Java. The base/JDK. Internal. Reflect. DelegatingConstructorAccessorImpl. NewInstance (DelegatingConstructorAccessorImpl. Java: 45)
The at Java. The base/Java. Lang. Reflect the Constructor. NewInstanceWithCaller (500) Constructor. Java:
The at Java. The base/Java. Lang. Reflect the Constructor. NewInstance (481) Constructor. Java:
At com. Mysql. JDBC. Util. HandleNewInstance (Util. Java: 425)
At com. Mysql. JDBC. ConnectionImpl. GetInstance (ConnectionImpl. Java: 386)
At com. Mysql. JDBC. NonRegisteringDriver. Connect (NonRegisteringDriver. Java: 330)
The at Java, SQL/Java. SQL. DriverManager. GetConnection (DriverManager. Java: 677)
The at Java, SQL/Java. SQL. DriverManager. GetConnection (DriverManager. Java: 228)
At com. Baomidou. Mybatisplus. Generator. Config. DataSourceConfig. GetConn (DataSourceConfig. Java: 170)
At com. Baomidou. Mybatisplus. Generator. Config. Builder. ConfigBuilder. HandlerDataSource (ConfigBuilder. Java: 285)
At com. Baomidou. Mybatisplus. Generator. Config. Builder. ConfigBuilder. & lt; init> (ConfigBuilder. Java: 137)
At com. Baomidou. Mybatisplus. Generator. AutoGenerator. Execute (AutoGenerator. Java: 89)
At the generator. MpGenerator. Main (MpGenerator. Java: 51)
? The Exception in the thread "main"? Java. Lang. NullPointerException
? At com. Baomidou. Mybatisplus. Generator. Config. Builder. ConfigBuilder. GetTablesInfo (ConfigBuilder. Java: 471)
At com. Baomidou. Mybatisplus. Generator. Config. Builder. ConfigBuilder. HandlerStrategy (ConfigBuilder. Java: 299)
? At com. Baomidou. Mybatisplus. Generator. Config. Builder. ConfigBuilder. & lt; init> (ConfigBuilder. Java: 144)
At com. Baomidou. Mybatisplus. Generator. AutoGenerator. Execute (AutoGenerator. Java: 89)
At the generator. MpGenerator. Main (MpGenerator. Java: 51)

Card has been here for two days, bosses, nullnull
  • Related