Welcome to part 5 of 8 in a series on Kick-Ass WordPress Optimization. This guide covers database and WordPress installation on a Digital Ocean droplet following server and DNS setup.
Installing MySQL and Configuring Your Database
Actually Installing MySQL
The foundation for WordPress requires a database to store posts, settings, and content. Installation begins with a console command:
sudo apt-get -y install mysql-server
During installation, you’ll be prompted to set a root password—this is critical to record for future access.
Creating a MySQL Database
After logging into MySQL with your root credentials, create a database with a command like:
CREATE DATABASE yourblog;
Creating a MySQL User
Rather than using the root account (a security risk), establish a dedicated user:
CREATE USER 'yourblog'@'localhost' IDENTIFIED BY 'yourpassword';
Granting User Permissions
Grant your new user database access:
GRANT ALL PRIVILEGES ON yourblog.* TO 'yourblog'@'localhost' WITH GRANT OPTION;
Tuning MySQL for WordPress
Optimize performance by editing /etc/mysql/my.cnf and adding InnoDB configuration parameters for buffer pooling, flush methods, and file-per-table settings. Restart MySQL to apply changes.
Installing and Configuring WordPress
Use the wget utility to download WordPress files directly to your server, then follow the standard installation wizard.