It is most likely caused by backups. Most servers create backups at night or during the early morning while the site is least active. The backup process uses a lot of system resources (RAM, CPU, Hard drive bandwidth) as it involves copying all the data to another storage device. Often, the data is also compressed. (ever tried zipping a very large file? - It can take awhile and may slow down your computer) This can result in a lack of system resources for other server processes. (such as MySQL - Database) This would explain why you see the database errors.
In cases such as that, the solution is to either upgrade the server or implement a load balancing setup. However, this comes at a cost and it's not always worth it, especially if the issue only results in a short outage during periods when few people are affected.