This post is going to show how PHPMyAdmin can be installed on your WordPress website. The assumption is that LEMP stack is already installed. Once logged onto your server, run the following commands:
sudo apt update
sudo apt install phpmyadmin
Installation process prompts to select a web server and does not give nginx as one of the options. Tab out and hit OK to skip this step.
In the next prompt, select Yes to configure a new database for phpmyadmin with dbconfig-common.
This step creates a new database user called:
Pick a strong password. You may use a website such as following to generate a strong password.
This will create a new database user with necessary privileges.
The following step needs to be completed before restarting the nginx server for changes to take place.
Change directory to /etc/nginx/sites-available and make below change to the default file.
Save the changes and restart the server using the following command.
sudo systemctl restart nginx
Now, type append /phpmyadmin the website URL to see the following phpMyAdmin login page.
Use username root and MySQL root password to login here.
Once logged in, phpMyAdmin page looks similar to this page.
Click on “SQL” tab to run the SQL queries. (Note: Only SELECT statements are executed and UPDATE statements are skipped to avoid updating the database)
SQL Statement Execution
- SELECT * FROM wp_posts WHERE post_type = ‘revision’
- SELECT guid, wp_posts.* FROM wp_posts WHERE post_type = ‘attachment’
- SELECT * FROM wp_options WHERE option_name IN ( ‘siteurl’,’home’ )
- SELECT * FROM wp_options WHERE option_name = ‘active_plugins’
- SELECT * FROM wp_options WHERE option_name = ‘akismet_spam_count’
- SELECT DISTINCT user_email FROM wp_users
- SELECT wc.* FROM wp_posts wp INNER JOIN wp_comments wc ON wp.ID = wc.comment_post_ID WHERE wp.ID = ‘1’
- SELECT wc.* FROM wp_comments wc INNER JOIN wp_users wu ON wc.user_id = wu.ID WHERE wu.user_login = ‘ram’
- SELECT * FROM wp_comments INNER JOIN wp_posts ON wp_comments.comment_post_id = wp_posts.ID WHERE wp_posts.ID = ‘1’
- SELECT * FROM wp_users INNER JOIN wp_usermeta ON wp_users.ID = wp_usermeta.user_id WHERE wp_users.ID = ‘1’