It's not immediately obvious how to do it, but connecting to your database from Drupal can be speeded up by using a unix socket. First though, you have to install Drupal using a TCP socket. Standard database installations listen on localhost so the install should proceed without problem.
Continue reading Use a Unix Socket Between Drupal 7 and MariaDB..