MariaDB [(none)]> CREATE DATABASE wpdb;\r\nMariaDB [(none)]> CREATE USER 'wpuser'@'localhost' identified by 'dbpassword';<\/pre>\nDon’t forget to choose a strong password for your database user.<\/p>\n
Now, you have a valid database and user for WordPress. Next, grant all the privileges to the WordPress database:<\/p>\n
MariaDB [(none)]> GRANT ALL PRIVILEGES ON wpdb.* TO 'wpuser'@'localhost';<\/pre>\nNext, flush the privileges to apply the changes we\u2019ve made and exit from the MariaDB shell with the following command:<\/p>\n
MariaDB [(none)]> FLUSH PRIVILEGES;\r\nMariaDB [(none)]> EXIT;<\/pre>\nOnce you have done, you can proceed to the next step.<\/p>\n
<\/span>Step 4: Install WordPress<\/span><\/h2>\nFirst, we will need to download the latest version of the WordPress source from its official website. Run the following command to download the latest release of WordPress:<\/p>\n
cd \/var\/www\/html\/\r\nwget https:\/\/wordpress.org\/latest.tar.gz<\/pre>\nOnce the download is completed, extract the downloaded file with the following command:<\/p>\n
tar -xvzf latest.tar.gz<\/pre>\nNext, change the directory to wordpress and copy the sample configuration file:<\/p>\n
cd wordpress\r\ncp wp-config-sample.php wp-config.php<\/pre>\nNext, open the file wp-config.php<\/code> with the nano editor:<\/p>\nnano wp-config.php<\/pre>\nChange the database, database user and password which we have created earlier:<\/p>\n
\/\/ ** MySQL settings - You can get this info from your web host ** \/\/\r\n\/** The name of the database for WordPress *\/\r\ndefine( 'DB_NAME', 'wpdb' );\r\n\r\n\/** MySQL database username *\/\r\ndefine( 'DB_USER', 'wpuser' );\r\n\r\n\/** MySQL database password *\/\r\ndefine( 'DB_PASSWORD', 'dbpassword' );\r\n\r\n\/** MySQL hostname *\/\r\ndefine( 'DB_HOST', 'localhost' );<\/pre>\nSave and close the file.<\/p>\n
Then, change the ownership of the wordpress directory with the following command:<\/p>\n
chown -R www-data:www-data \/var\/www\/html\/wordpress<\/pre>\n