Skip to main content

Posts

Showing posts from October, 2020

Restoring Database and Wordpress Site

  Command based Restoring Database and Wordpress Site First you need to have the backup files ready. Visit my recent post on how to backup database and wordpress site .   Photo by Carl Heyerdahl on Unsplash   Restore DB Having the backup files ready, following below steps to restore it properly. Ensure MySQL is installed For Windows users can checkout this tutorial https://dev.mysql.com/doc/refman/8.0/en/windows-installation.html Ensure mysql path is set in the environment For Windows users can checkout this tutorial https://dev.mysql.com/doc/mysql-windows-excerpt/5.7/en/mysql-installation-windows-path.html Run following commands to create db, assign new users, and restore db. Access MySQL by running below command mysql Create the user that you wanted to use / manage the db in wordpress later.  create USER testrestore@localhost IDENTIFIED BY '<the user password>'; Create the database that you wanted to use for wordpress later.  create DATABASE mydatabase...

Create Wordpress Website & MySQL Database Backup then Upload to Gdrive

 It's easy to use plugin, but you only need few commands to run :D Usually Wordpress user will just quickly find a plugin to backup the website and its databases. Is it to daunting to do it by ourselves? Photo by Science in HD on Unsplash     I find plugin is easy in certain way, but for an admin myself, i prefer simple command / script to get the job done.  Create database backup This is the command required to run a simple database backup in mysql.p/s you can change the destination path. I put in /tmp because i want to upload to gdrive later.   If you choose to upload to Gdrive Normally a user might just want to backup the file to its host server. For this case i wanted to upload the backup file(s) to Gdrive. And im using a third party Gdrive command client . You might want to checkout tutorial on how to get it installed in your server~   **Use at your own risk! the third party cli will have access and write permission to your Gdrive files!**   I...

Create a Wordpress Cron Job to Send Reminder

 Hi All,     The following code is sample of how to create a WP Cron and send out email reminder to targeted seller/admin. You may use this as reference and change accordingly. Please read the code comments to understand the flow! This code will check seller users that is not active for 1 month to send reminder to them and delete seller products that is not active for 3 months. To better enhance the code you can actually just set the product as draft instead of deleting it directly.