使用 SSL/TLS 连接
错误信息
server does not allow insecure connections, client must use SSL/TLS
解决办法
{
type: 'mysql',
host: localhost,
port: 3306,
......
synchronize: true,
+ ssl: true,
+ extra: {
+ ssl: {
+ rejectUnauthorized: true,
+ },
+ },
}
不支持 SQL 的 UNION 语句
错误信息
这里使用的是 NestJS,当有多张表的时候,会报以下错误
we cannot push output columns into *physical.Union
原因
Hello @rehan-sattar!
This issue is likely due to a known compatibility issue with the way TypeORM puts together certain metadata related queries, which led to this fork created by one of our users some months back:
github.com/terracefi/t…You can review the main commit made in the fork below, which primarily is just working around how TypeORM typically generates a few metadata related queries:
typeorm/typeorm@008f52d#diff-78ff8320cc81d7f789d6ee8fa43c23fb755e01dc3d7f13d5e5fda1b85e6e5e56R1312-R1318Typically a
UNIONstatement is used, but the commit above switches this to use anINstatement instead.The reason for the problem currently is due to the open source Vitess layer used within the PlanetScale platform not fully supporting all MySQL 8 syntax just yet, but this will eventually be corrected and the issue will go away once those compatibility issues are resolved.
We recently had an issue submission related to TypeORM that shared the same error you described and we believe the solution in the fork above will provide a solution, but it would be nice to confirm that it is in fact helpful for this problem so if you have a chance to give it a try we'd be happy to hear back on what your results are!
解决办法
目前来看只能通过降低 TypeORM 的版本来解决