If your website database is too large when restoring a backup, it often fails to import, showing a 502 Bad Gateway error. The solution is to increase the PHP timeout, but a more stable solution is to import directly using server commands.
Usually, we import databases via the phpMyAdmin interface, but if the database is too large, it may exceed the server processing time and cause a 502 error. Increasing the timeout can solve part of the problem.
However, if the database is too large, even modifying the timeout may fail to import. Below, I share a method commonly used in my work: directly importing from the server using commands.
mysql -u用户名 -p密码 数据库名 < 数据库名.sql #mysql -uroot -p123 abc < abc.sql
Using commands and demonstration as above, directlyconnect to the VPS, then use the mysql command to import.
Another method is to import in parts, which can be done when exporting earlier.database backupYou can directly split and package it into volumes, but Naiba hasn't used it yet. If you're interested, you can search for related articles yourself.