How to recreate WordPress table

The error's output like the following:

Error    : Table 'XXXX_wrdp1.wp_comments' doesn't exist

mysql DATABASE_NAME;
DROP TABLE IF EXISTS wp_comments;
CREATE TABLE wp_comments (
comment_ID bigint(20) unsigned NOT NULL auto_increment,
comment_post_ID int(11) NOT NULL default '0',
comment_author tinytext NOT NULL,
comment_author_email varchar(100) NOT NULL default '',
comment_author_url varchar(200) NOT NULL default '',
comment_author_IP varchar(100) NOT NULL default '',
comment_date datetime NOT NULL default '0000-00-00 00:00:00',
comment_date_gmt datetime NOT NULL default '0000-00-00 00:00:00',
comment_content text NOT NULL,
comment_karma int(11) NOT NULL default '0',
comment_approved varchar(20) NOT NULL default '1',
comment_agent varchar(255) NOT NULL default '',
comment_type varchar(20) NOT NULL default '',
comment_parent bigint(20) NOT NULL default '0',
user_id bigint(20) NOT NULL default '0',
PRIMARY KEY (comment_ID),
KEY comment_approved (comment_approved),
KEY comment_post_ID (comment_post_ID),
KEY comment_approved_date_gmt (comment_approved,comment_date_gmt),
KEY comment_date_gmt (comment_date_gmt)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

You may know about WordPress table's structure here:

http://codex.wordpress.org/Database_Description#Table:_wp_comments… Read the rest

Changing Drupal’s theme via mysql command line

Download for example "garland" theme to ./sites/all/themes folder from

https://www.drupal.org/project/garland

Then:

UPDATE dr_system SET status=1 WHERE name = 'garland';

Then:

UPDATE dr_variable SET value='s:7:"garland"' WHERE name = 'theme_default';
TRUNCATE dr_cache;
TRUNCATE dr_cache_bootstrap;
TRUNCATE dr_cache_block;

Here is Drush method

drush vset theme_default garland
Read the rest

How to install WP-CLI

WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, set up multisite installs and much more, without using a web browser

cd
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod 755 wp-cli.phar
mv wp-cli.phar wp
mkdir wp_cli
mv wp wp_cli
echo "alias wp='~/wp_cli/wp'" >> ~/.bashrc
Read the rest

How to upgrade your WordPress to the latest version via command line

It may fix various problems with your WordPress

First of all backup your files and database

Enter your www/ folder

cd /home/USER/public_html

Download/extract and replace files using latest WordPress version from an original source

wget https://wordpress.org/latest.zip

unzip latest.zip

rsync -avz wordpress/* ./
Read the rest

How to reset forgotten mysql root password

Login server as root and stop/kill mysql processes

Start mysql server with skip-grant-tables

mysqld_safe --skip-grant-tables

mysql

use mysql;
update user set Password=PASSWORD('new-password') where user='root';
flush privileges;

Done!

Now kill mysql processes and restart your mysql server… Read the rest

How to disable/enable all wordpress plugin via mysql/shell command lines

In order to view active plugins run:

mysql
use database;
SELECT * FROM wp_options WHERE option_name = "active_plugins";

From shell command line

mysql --host=localhost --user=database_user --password=dbpassword database -e 'SELECT * FROM wp_options WHERE option_name = "active_plugins";'

Save active plugins to file

mysql --host=localhost --user=database_user --password=dbpassword database -e 'SELECT * FROM wp_options WHERE option_name = "active_plugins";' |grep active_plugins |awk '{print $3}' > active_plugins.txt
Read the rest

How to disable eximstats via command line

Firsly check if running

/usr/local/cpanel/bin/tailwatchd --status

Output:
  Driver (Active: 0) Cpanel::TailWatch::JailManager
  Driver (Active: 1) Cpanel::TailWatch::ChkServd
  Driver (Active: 1) Cpanel::TailWatch::Eximstats
  Driver (Active: 0) Cpanel::TailWatch::Antirelayd
  Driver (Active: 1) Cpanel::TailWatch::cPBandwd

Disable eximstats by running:

/usr/local/cpanel/bin/tailwatchd --disable=Cpanel::TailWatch::Eximstats

Done!

You may then decrease size of eximstats database if needed
Enter eximstats database directly

mysql eximstats
and delete data from the following tables:

delete from sends;
delete from smtp;
delete from failures;
delete from defers;

Done, Enjoy!… Read the rest

Disable mysql password authentification

Reset mysql password

/usr/bin/mysqladmin -u root password 'new-password'

Add the following lines to your /root/.my.cnf file

vi /root/.my.cnf

[mysqladmin]
user=root
password=new-password

[client]
user=root
password=new-password

Update permissions to 0600

chmod 600 /root/.my.cnf

Restart your mysql server

service mysqld restartRead the rest