WordPress database configuration with UNIX socket

WordPress database configuration with UNIX socket

Note that as the MySQL hostname, we are not only pointing to localhost, but also to a UNIX socket. Connecting this way instead of simply using “localhost” will discard the TCP overhead and slightly increase performance.

This is a part of “Self hosting WordPress securely in 2018 on FreeBSD with nginx, PHP 7.2, ModSecurity, brotli, Let’s Encrypt SSL” post. Proper path to MySQL or MariaDB socket is required.
 
When you are asked to provide database information, type in the following:

  • Database name: wordpressdb
  • Username: wordpressuser
  • Password: [user password generated during MariaDB configuration]
  • Database Host: localhost:/tmp/mysql.sock
  • Table Prefix: blah_

Change table prefix from “wp_” to something else – like “blah_” – as an additional protection against SQL injection attacks.

WordPress database configuration with UNIX socket
Note that as the MySQL hostname, we are not only pointing to localhost, but also to a UNIX socket. Connecting this way instead of simply using “localhost” will discard the TCP overhead and slightly increase performance.

Change table prefix from “wp_” to something else – like “blah_” – as an additional protection against SQL injection attacks.

Post:

Self hosting WordPress securely in 2018 on FreeBSD with nginx, PHP 7.2, ModSecurity, brotli, Let’s Encrypt SSL

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.