MySQL Commands

Here we will show some most important MySQL commands that we need to apply for daily jobs.

MySQL Commands for WordPress

For Database Optimization

  • Revisions Clean: DELETE FROM posts WHERE post_type = ‘revision’
  • Auto Draft Clean: DELETE FROM posts WHERE post_status = ‘auto-draft’
  • Pending Comments Clean: DELETE FROM comments WHERE comment_approved = ‘0’
  • Spam Comments Delete: DELETE FROM comments WHERE comment_approved = ‘spam’
  • Trash Comment Clean: DELETE FROM comments WHERE comment_approved = ‘trash’
  • Trackbacks Clean: DELETE FROM comments WHERE comment_type = ‘trackback’
  • Pingbacks Clean: DELETE FROM comments WHERE comment_type = ‘pingback’
  • Orphan post meta: DELETE pm FROM postmeta pm LEFT JOIN posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL
  • Orphan comment meta: DELETE FROM commentmeta WHERE comment_id NOT IN (SELECT comment_id FROM comments)
  • Orphan user meta: DELETE FROM usermeta WHERE user_id NOT IN (SELECT ID FROM users)
  • Orphan Relationships: DELETE FROM term_relationships WHERE term_taxonomy_id=1 & object_id NOT IN (SELECT id FROM posts)
  • Expired Transients:
  • Pending Comments: DELETE FROM comments WHERE comment_approved = ‘0’

Question: Should I delete Trackbacks an Pingbacks comments for Speed and Database optimization?

MySQL Commands for PHP

How to restore files from online to local server. For this, at first login your cpanel. www.yourdomain.com/cpanel. Provide user name and password and login. Generally web folder contain in Public_html folder. So download your web folder under Public_html.

After installing Xampp in local server some files of php.ini need to edit before run it offline.

select * from cuttingproduction where buyerr=’C’ and ordr=’A’;

delete from cuttingproduction where buyerr=’C’ and ordr=’A’;

delete from ordr where ccbuyerr=’C’ and ccordr=’A’;

delete from sizzze where ccbuyerr=’C’ and ccordr=’A’;

delete from colourr where ccbuyerr=’C’ and ccordr=’A’;

delete from lott where ccbuyerr=’C’ and ccordr=’A’;

delete from countryy where ccbuyerr=’C’ and ccordr=’A’;

select * from cuttingproduction where buyerr=’Z’ and ordr in (‘V’,’Z’,’L’,’M’,’W’,’S’,’K’,’B’,’R’,’G’,’N’,’U’,’J’,’X’,’Y’,’A’,’C’,’Q’);

delete from ordr where ccbuyerr=’Z’ and ccordr in (‘V’,’Z’,’L’,’M’,’W’,’S’,’K’,’B’,’R’,’G’,’N’,’U’,’J’,’X’,’Y’,’A’,’C’,’Q’);

delete from colourr where ccbuyerr=’Z’ and ccordr in (‘V’,’Z’,’L’,’M’,’W’,’S’,’K’,’B’,’R’,’G’,’N’,’U’,’J’,’X’,’Y’,’A’,’C’,’Q’);

delete from sizzze where ccbuyerr=’Z’ and ccordr in (‘V’,’Z’,’L’,’M’,’W’,’S’,’K’,’B’,’R’,’G’,’N’,’U’,’J’,’X’,’Y’,’A’,’C’,’Q’);

delete from lott where ccbuyerr=’Z’ and ccordr in (‘V’,’Z’,’L’,’M’,’W’,’S’,’K’,’B’,’R’,’G’,’N’,’U’,’J’,’X’,’Y’,’A’,’C’,’Q’);

delete from countryy where ccbuyerr=’Z’ and ccordr in (‘V’,’Z’,’L’,’M’,’W’,’S’,’K’,’B’,’R’,’G’,’N’,’U’,’J’,’X’,’Y’,’A’,’C’,’Q’);

select * from cuttingproduction where buyerr=’W’ and ordr in (‘I’,’J’,’L’,’M’,’N’,’O’,’P’,’Q’,’R’,’S’,’T’,’V’,’A’,’B’,’C’,’D’,’E’,’F’,’G’,’K’,’U’,’W’);

delete from cuttingproduction where buyerr=’W’ and ordr in (‘I’,’J’,’L’,’M’,’N’,’O’,’P’,’Q’,’R’,’S’,’T’,’V’,’A’,’B’,’C’,’D’,’E’,’F’,’G’,’K’,’U’,’W’);

delete from ordr where ccbuyerr=’W’ and ccordr in (‘I’,’J’,’L’,’M’,’N’,’O’,’P’,’Q’,’R’,’S’,’T’,’V’,’A’,’B’,’C’,’D’,’E’,’F’,’G’,’K’,’U’,’W’);

delete from colourr where ccbuyerr=’W’ and ccordr in (‘I’,’J’,’L’,’M’,’N’,’O’,’P’,’Q’,’R’,’S’,’T’,’V’,’A’,’B’,’C’,’D’,’E’,’F’,’G’,’K’,’U’,’W’);

delete from sizzze where ccbuyerr=’W’ and ccordr in (‘I’,’J’,’L’,’M’,’N’,’O’,’P’,’Q’,’R’,’S’,’T’,’V’,’A’,’B’,’C’,’D’,’E’,’F’,’G’,’K’,’U’,’W’);

delete from lott where ccbuyerr=’W’ and ccordr in (‘I’,’J’,’L’,’M’,’N’,’O’,’P’,’Q’,’R’,’S’,’T’,’V’,’A’,’B’,’C’,’D’,’E’,’F’,’G’,’K’,’U’,’W’);

delete from countryy where ccbuyerr=’W’ and ccordr in (‘I’,’J’,’L’,’M’,’N’,’O’,’P’,’Q’,’R’,’S’,’T’,’V’,’A’,’B’,’C’,’D’,’E’,’F’,’G’,’K’,’U’,’W’);

We also sale

Help Line

Subject URL
WordPress PhpMyadminyoutube.com/watch?v=42fNfYuT2tM