One solution:
If an error occurs during Website access, check my. cnf: It is found that innodb_buffer_pool_size = 2048 M is too large and can be adjusted to innodb_buffer_pool_size = 1024M. There are other solutions to this problem on the Internet, but none of them can solve my problem.
Lost connection to MySQL server at 'reading initial communication packet'
I solved this problem last time. Today I encountered another problem. I suddenly lost my memories and finally got it done after I did some useless work. This time, I must record it to avoid wasting time next time.
1. Modify the mysql configuration file
Vi/etc/my. cnf
[Mysqld] segment and skip-name-resolve
Before that, you need to enable the remote access permission of mysql, or add the skip-grant-table (not recommended)
2. Modify hosts. allow
Vi/etc/hosts. allow
Add mysqld: ALL: ALLOW
Mysqld-max: ALL: ALLOW