I've searched a bunch on the internet, but they're all wrong
Later, I realized that it was actually a setting problem.
When your code is deployed to the server, your mysql host value should be
127.0.0.1
instead of your server ip
Otherwise, an error will be reported.
In fact, when your code enters the server, mysql and the code are equivalent to the same ip, so use 127.0.0.1 instead of the server ip
remember! No need to change any configuration issues.