This guide helps you troubleshoot database-related problems, migration errors, and data integrity issues with ShahiLandin.
Database Tables Missing
Symptom
Plugin activated but features don’t work, or errors mentioning missing tables.
Solutions
Problem 1: Tables Not Created During Activation
Error Message:
`
Table ‘wpshahilandinanalytics’ doesn’t exist
`
Solution 1 – Reactivate Plugin:
- Go to Plugins page
- Deactivate ShahiLandin
- Wait 5 seconds
- Activate ShahiLandin again
- Check if tables were created
- Access phpMyAdmin
- Click on your WordPress database
- Check if user has CREATE TABLE permission
- Grant permissions if missing (contact host if needed)
- Download
run-migrations.phpfile from plugin folder - Upload to WordPress root directory (same level as wp-config.php)
- Visit
https://yoursite.com/run-migrations.phpin browser - Follow on-screen instructions
- Delete the file after completion (security)
- Log into phpMyAdmin
- Select your WordPress database
- Look for these tables:
- Increase PHP execution time in
.htaccess: - Or in
wp-config.php: - Run migration again
- Previous migration may have crashed
- Clear migration lock:
- Or via phpMyAdmin:
- Retry migration
- Check current schema version:
- Compare with plugin version
- Force re-run migrations:
- Or reset and rebuild:
- Usually caused by inconsistent storage engines
- Check table engines:
- Ensure all tables use InnoDB:
- Go to Landing Pages
- Click Trash link at top
- Select pages to restore
- Click Restore
- If you have database backup, restore it
- Use tools like UpdraftPlus or BackWPup
- Or contact hosting provider for backup restoration
- Check if data retention policy deleted old data:
- Query database to verify:
- If truly deleted:
- Add to
wp-config.php: - Visit:
https://yoursite.com/wp-admin/maint/repair.php - Click Repair Database
- Remove the define line after repair
- Go to phpMyAdmin
- Select your database
- Check corrupted table
- Click Operations tab
- Click Repair table
- Ensure import file is valid JSON or CSV
- Validate JSON: https://jsonlint.com/
- Check CSV has proper headers
- Split large files into smaller chunks
- Import in batches
- Go to Settings → Analytics
- Set Data Retention Period: 90 days (or as needed)
- Old data automatically deleted daily
- Blog 1:
wpshahilandinanalytics - Blog 2:
wp2shahilandin_analytics - Blog 3:
wp3shahilandin_analytics - Go to Network Admin → Plugins
- Click Network Activate on ShahiLandin
- Backup first before any destructive operations
- Collect information:
- Export schema:
- Check table integrity:
- Contact support with:
- Installation and Activation Issues
- Performance Issues
- Cache and Plugin Conflicts
Solution 2 – Check Database Permissions:
Solution 3 – Run Manual Migration:
Solution 4 – Use WP-CLI:
`bash
wp shahilandin migrate
`
Problem 2: Verify Tables Exist
Check if ShahiLandin tables exist in database:
Via phpMyAdmin:
– wpshahilandinanalytics
– wpshahilandinexperiments
– wp_posts (standard WordPress table, used for landing pages)
– wp_postmeta (standard WordPress table, used for landing page meta)
Via WP-CLI:
`bash
List all tables
wp db tables –scope=all
Check specific table
wp db query “DESCRIBE wpshahilandinanalytics”
`
If tables are missing, proceed with manual migration above.
Migration Errors
Symptom
Errors during plugin update or database migration.
Solutions
Problem 1: Migration Script Timeout
Error Message:
`
Maximum execution time of 30 seconds exceeded
`
Solution:
`apache
phpvalue maxexecution_time 300
phpvalue maxinput_time 300
`
`php
settimelimit(300);
`
Problem 2: Migration Already Running
Error Message:
`
Migration already in progress
`
Solution:
`bash
wp option delete shahilandinmigrationlock
`
`sql
DELETE FROM wpoptions WHERE optionname = ‘shahilandinmigrationlock’;
`
Problem 3: Database Schema Mismatch
Symptom: Plugin expects different table structure than what exists.
Solution:
`bash
wp option get shahilandindbversion
`
`bash
wp shahilandin migrate –force
`
`sql
— CAUTION: This deletes ALL ShahiLandin data
DROP TABLE IF EXISTS wpshahilandinanalytics;
DROP TABLE IF EXISTS wpshahilandinexperiments;
DELETE FROM wpoptions WHERE optionname LIKE ‘shahilandin_%’;
`
Then reactivate plugin to recreate tables.
Problem 4: Foreign Key Constraints
Error Message:
`
Cannot add foreign key constraint
`
Solution:
`sql
SELECT TABLE_NAME, ENGINE
FROM information_schema.TABLES
WHERE TABLESCHEMA = ‘yourdatabase_name’
AND TABLENAME LIKE ‘wpshahilandin%’;
`
`sql
ALTER TABLE wpshahilandinanalytics ENGINE=InnoDB;
ALTER TABLE wpshahilandinexperiments ENGINE=InnoDB;
`
Data Loss Issues
Symptom
Landing pages, analytics data, or experiments disappeared.
Solutions
Problem 1: Landing Pages Deleted
Solution 1 – Check Trash:
Solution 2 – Check Database:
`sql
— Find trashed landing pages
SELECT ID, posttitle, poststatus
FROM wp_posts
WHERE posttype = ‘shahilanding’
AND post_status = ‘trash’;
— Restore from trash
UPDATE wp_posts
SET post_status = ‘publish’
WHERE ID =
`
Solution 3 – Restore from Backup:
Problem 2: Analytics Data Missing
Symptom: Historical analytics data disappeared.
Solution:
– Settings → Analytics → Data Retention Period
`sql
— Check if any analytics data exists
SELECT COUNT(*) FROM wpshahilandinanalytics;
— Check date range of data
SELECT MIN(createdat) as oldest, MAX(createdat) as newest
FROM wpshahilandinanalytics;
`
– Check database backups
– Data may be in exported CSV/JSON files
– Contact support with backup if available
Problem 3: Experiments Lost
Solution:
`sql
— Check experiments table
SELECT * FROM wpshahilandinexperiments;
— Check if experiments are “soft deleted”
SELECT * FROM wpshahilandinexperiments WHERE deleted_at IS NOT NULL;
— Restore soft-deleted experiment
UPDATE wpshahilandinexperiments
SET deleted_at = NULL
WHERE id =
`
Database Corruption
Symptom
Errors indicating corrupted tables or data inconsistencies.
Solutions
Problem 1: Table Crashed
Error Message:
`
Table ‘wpshahilandinanalytics’ is marked as crashed and should be repaired
`
Solution 1 – Automatic Repair:
`php
define(‘WPALLOWREPAIR’, true);
`
Solution 2 – Manual Repair via phpMyAdmin:
Solution 3 – WP-CLI:
`bash
wp db repair
`
Problem 2: Orphaned Meta Data
Symptom: Database bloated with meta data for deleted posts.
Solution:
Clean up orphaned data:
`sql
— Count orphaned meta
SELECT COUNT(*) FROM wp_postmeta
WHERE postid NOT IN (SELECT ID FROM wpposts);
— Delete orphaned meta (CAUTION: Backup first)
DELETE FROM wp_postmeta
WHERE postid NOT IN (SELECT ID FROM wpposts);
— Optimize table after cleanup
OPTIMIZE TABLE wp_postmeta;
`
Problem 3: Duplicate Entries
Symptom: Duplicate analytics events or experiments.
Solution:
`sql
— Find duplicate analytics entries
SELECT postid, createdat, COUNT(*) as duplicates
FROM wpshahilandinanalytics
GROUP BY postid, createdat
HAVING COUNT(*) > 1;
— Remove duplicates (keeps one, deletes rest)
DELETE t1 FROM wpshahilandinanalytics t1
INNER JOIN wpshahilandinanalytics t2
WHERE t1.id > t2.id
AND t1.postid = t2.postid
AND t1.createdat = t2.createdat;
`
Import/Export Issues
Symptom
Cannot import or export landing pages or data.
Solutions
Problem 1: Export Timeout
Symptom: Export process hangs or times out with large datasets.
Solution 1 – Export in Batches:
`bash
Export specific date range
wp shahilandin export –from=2024-01-01 –to=2024-03-31 –format=csv > Q1-2024.csv
Export specific landing page
wp shahilandin export –post-id=123 –format=json > landing-123.json
`
Solution 2 – Increase PHP Limits:
`apache
In .htaccess
phpvalue memorylimit 512M
phpvalue maxexecution_time 300
`
Solution 3 – Direct Database Export:
`bash
Export via mysqldump
mysqldump -u username -p databasename wpshahilandinanalytics > analyticsbackup.sql
`
Problem 2: Import Fails
Symptom: Importing landing pages or data results in errors.
Solution 1 – Check File Format:
Solution 2 – Check File Size:
Solution 3 – Fix Encoding Issues:
`bash
Convert file to UTF-8
iconv -f ISO-8859-1 -t UTF-8 import.csv > import-utf8.csv
`
Solution 4 – Import via WP-CLI:
`bash
Import landing pages
wp shahilandin import landing-pages.json
Import with dry-run first
wp shahilandin import landing-pages.json –dry-run
`
Performance Issues
Symptom
Database queries slow, admin dashboard takes long to load.
Solutions
Problem 1: Missing Indexes
Solution:
Add indexes to improve query performance:
`sql
— Analytics table indexes
ALTER TABLE wpshahilandinanalytics
ADD INDEX idxpostid (post_id);
ALTER TABLE wpshahilandinanalytics
ADD INDEX idxcreatedat (created_at);
ALTER TABLE wpshahilandinanalytics
ADD INDEX idx_goal (goal);
ALTER TABLE wpshahilandinanalytics
ADD INDEX idxexperimentid (experiment_id);
— Composite index for common queries
ALTER TABLE wpshahilandinanalytics
ADD INDEX idxpostcreated (postid, createdat);
`
Problem 2: Large Analytics Table
Symptom: wpshahilandinanalytics table has millions of rows.
Solution 1 – Archive Old Data:
`sql
— Export old data before deletion
SELECT * FROM wpshahilandinanalytics
WHERE createdat < DATESUB(NOW(), INTERVAL 6 MONTH)
INTO OUTFILE ‘/tmp/analytics_archive.csv’;
— Delete old data
DELETE FROM wpshahilandinanalytics
WHERE createdat < DATESUB(NOW(), INTERVAL 6 MONTH);
— Optimize table
OPTIMIZE TABLE wpshahilandinanalytics;
`
Solution 2 – Enable Auto-Cleanup:
Solution 3 – Partition Table (Advanced):
`sql
— Partition by date for better performance
ALTER TABLE wpshahilandinanalytics
PARTITION BY RANGE (YEAR(created_at)) (
PARTITION p2023 VALUES LESS THAN (2024),
PARTITION p2024 VALUES LESS THAN (2025),
PARTITION p2025 VALUES LESS THAN (2026),
PARTITION pmax VALUES LESS THAN MAXVALUE
);
`
Problem 3: Slow Query Log
Solution:
Identify slow queries:
`sql
— Enable slow query log (if not already)
SET GLOBAL slowquerylog = ‘ON’;
SET GLOBAL longquerytime = 2; — Log queries over 2 seconds
— Check slow queries
SHOW GLOBAL STATUS LIKE ‘Slow_queries’;
`
Review slow query log and optimize identified queries.
Character Encoding Issues
Symptom
Special characters display as �, or foreign language text garbled.
Solutions
Problem 1: Wrong Database Charset
Solution:
Convert database to UTF-8:
`sql
— Check current charset
SHOW TABLE STATUS WHERE Name = ‘wpshahilandinanalytics’;
— Convert to UTF-8
ALTER TABLE wpshahilandinanalytics
CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4unicodeci;
ALTER TABLE wpshahilandinexperiments
CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4unicodeci;
`
Problem 2: wp-config.php Charset Setting
Solution:
Ensure wp-config.php has correct charset:
`php
define(‘DB_CHARSET’, ‘utf8mb4’);
define(‘DBCOLLATE’, ‘utf8mb4unicode_ci’);
`
Problem 3: Existing Data with Wrong Encoding
Solution:
Fix existing data:
`sql
— Update specific field
UPDATE wp_postmeta
SET metavalue = CONVERT(CAST(CONVERT(metavalue USING latin1) AS BINARY) USING utf8mb4)
WHERE metakey = ‘shahilandin_html’;
`
Multisite Database Issues
Symptom
Issues specific to WordPress Multisite installations.
Solutions
Problem 1: Tables on Wrong Blog
Symptom: Plugin activated but tables missing on subsite.
Solution:
In multisite, each blog has separate tables:
Network activate plugin to create tables for all sites:
Problem 2: Shared Analytics Across Network
Symptom: Want to aggregate analytics from all subsites.
Solution:
Create custom query across all blog tables:
`sql
— Get analytics from all sites
SELECT * FROM wpshahilandinanalytics
UNION ALL
SELECT * FROM wp2shahilandin_analytics
UNION ALL
SELECT * FROM wp3shahilandin_analytics;
`
Or use WP-CLI to iterate:
`bash
Export analytics from all sites
wp site list –field=url | xargs -I {} wp –url={} shahilandin export
`
Backup and Restore
Creating Backups
Full Database Backup:
`bash
Backup entire database
mysqldump -u username -p databasename > fullbackup.sql
Backup only ShahiLandin data
mysqldump -u username -p database_name \
wpshahilandinanalytics \
wpshahilandinexperiments \
wp_posts \
wp_postmeta \
> shahilandin_backup.sql
`
Table-Specific Backup:
`bash
Backup analytics only
mysqldump -u username -p databasename wpshahilandinanalytics > analyticsbackup.sql
Backup with compression
mysqldump -u username -p database_name | gzip > backup.sql.gz
`
Using WP-CLI:
`bash
Export database
wp db export shahilandin_backup.sql
Export specific tables
wp db export shahilandinbackup.sql –tables=wpshahilandinanalytics,wpshahilandin_experiments
`
Restoring Backups
Full Restore:
`bash
Restore from SQL file
mysql -u username -p databasename < fullbackup.sql
Or via WP-CLI
wp db import full_backup.sql
`
Selective Restore:
`sql
— Restore only analytics data
SOURCE analytics_backup.sql;
— Or import specific table
mysql -u username -p databasename < analyticsbackup.sql
`
Database Optimization
Regular Maintenance Tasks
Daily Tasks:
`sql
— Clean up old analytics (if retention enabled)
DELETE FROM wpshahilandinanalytics
WHERE createdat < DATESUB(NOW(), INTERVAL 90 DAY);
— Clean up auto-drafts
DELETE FROM wp_posts
WHERE posttype = ‘shahilanding’
AND post_status = ‘auto-draft’
AND postmodified < DATESUB(NOW(), INTERVAL 7 DAY);
`
Weekly Tasks:
`sql
— Optimize tables
OPTIMIZE TABLE wpshahilandinanalytics;
OPTIMIZE TABLE wpshahilandinexperiments;
OPTIMIZE TABLE wp_posts;
OPTIMIZE TABLE wp_postmeta;
— Analyze tables for query optimization
ANALYZE TABLE wpshahilandinanalytics;
ANALYZE TABLE wpshahilandinexperiments;
`
Monthly Tasks:
`sql
— Check for corrupted tables
CHECK TABLE wpshahilandinanalytics;
CHECK TABLE wpshahilandinexperiments;
— Repair if needed
REPAIR TABLE wpshahilandinanalytics;
`
Automated Maintenance via WP-CLI
Create a cron job:
`bash
Daily optimization script
0 3 * wp db optimize
Weekly cleanup script
0 2 0 wp shahilandin cleanup –days=90
`
Getting Help
If database issues persist:
– Database size: wp db size
– Table status: wp db tables --scope=all
– Database version: wp db cli version
– Error messages from debug.log
`bash
mysqldump -u username -p –no-data database_name > schema.sql
`
`sql
CHECK TABLE wpshahilandinanalytics;
CHECK TABLE wpshahilandinexperiments;
`
– Database error messages
– Table structure (schema)
– Steps to reproduce issue
– Backup of affected data (if possible)
—
Related Articles:
Share this article
Still need help?
Our support team is ready to assist you with personalized guidance for your workspace.