codingapi / codingapi/tx-lcn

开启日志记录初始化表DataSource连接有问题

Ouverte
#462 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Java
Étoiles
4.2k
Forks
1.4k
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

- [ ] I have searched the [issues](https://github.com/codingapi/tx-lcn/issues) of this repository and believe that this is not a duplicate.

### 1. Bug Description
tx-lcn.logger.enabled=true 时DataSource会变成本地IP。username@本地IP 。mysql版本8.0.7
感觉是 HikariDataSource getConnection的问题。但没仔细看我先关掉这个配置了

### 2. Environment:
- JDK version:
- OS:
- TX-LCN version:5.0.2
- Others:
tx-lcn.logger.enabled=true
tx-lcn.logger.driver-class-name=com.mysql.cj.jdbc.Driver
tx-lcn.logger.jdbc-url=jdbc:mysql://192.168.0.10:3308/tx-manager?useSSL=false&characterEncoding=utf8&serverTimezone=UTC&allowPublicKeyRetrieval=true
tx-lcn.logger.username=username
tx-lcn.logger.password=password

### 3. Exception Stacktrace
java.sql.SQLException: CREATE command denied to user 'username'@'192.168.0.226' for table 't_logger' Query: CREATE TABLE IF NOT EXISTS `t_logger` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`group_id` varchar(64) NOT NULL ,
`unit_id` varchar(32) NOT NULL ,
`tag` varchar(50) NOT NULL ,
`content` varchar(1024) NOT NULL ,
`create_time` varchar(30) NOT NULL,
`app_name` varchar(128) NOT NULL,
PRIMARY KEY (`id`) USING BTREE
) Parameters: []
at org.apache.commons.dbutils.AbstractQueryRunner.rethrow(AbstractQueryRunner.java:527) ~[commons-dbutils-1.7.jar:1.7]
at org.apache.commons.dbutils.QueryRunner.update(QueryRunner.java:531) ~[commons-dbutils-1.7.jar:1.7]
at org.apache.commons.dbutils.QueryRunner.update(QueryRunner.java:497) ~[commons-dbutils-1.7.jar:1.7]
at com.codingapi.txlcn.logger.db.LogDbHelper.update(LogDbHelper.java:55) ~[classes/:na]
at com.codingapi.txlcn.logger.helper.MysqlLoggerHelper.init(MysqlLoggerHelper.java:70) [classes/:na]
at com.codingapi.txlcn.common.runner.TxLcnApplicationRunner.run(TxLcnApplicationRunner.java:54) [classes/:na]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:809) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:799) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:341) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
at com.codingapi.txlcn.tm.TMApplication.main(TMApplication.java:35) [classes/:na]
```
Paste your Exception Stacktrace here!
```

### 4. Tour Idea

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Commencez par MysqlLoggerHelper.java et LogDbHelper.java, puis suivez l’initialisation depuis TxLcnApplicationRunner.java tout en reproduisant le problème avec tx-lcn.logger.enabled=true et les paramètres MySQL fournis. Le travail est terminé lorsque la DataSource configurée se connecte à l’hôte prévu et peut initialiser t_logger sans l’erreur de permission CREATE.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java, mysql, spring-boot
Domaine
backend, databases
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.