Fix Database Issues

Solutions for common database errors encountered with Customer History.

Table Creation Errors

Error during plugin activation:

Error Message

Error creating tables: Table ‘wp_puredevs_customer_sessions’ doesn’t exist

Solutions:

  • Check database user has CREATE TABLE permissions
  • Verify database isn’t full or at quota
  • Try deactivating and reactivating plugin
  • Manually create tables (contact support for SQL)

Connection Errors

Database connection lost:

  • Check wp-config.php database credentials
  • Verify database server is running
  • Test connection with other plugins
  • Contact hosting provider
  • Check database server status

Query Errors

SQL query failures:

  1. Enable WordPress debug mode
  2. Check debug.log for SQL errors
  3. Note the specific query failing
  4. Report to support with error message

Common causes:

  • Corrupted table
  • Missing indexes
  • Insufficient memory
  • Timeout on large queries

Repair Database Tables

Fix corrupted tables:

  1. Go to Customer History → Tools → Database
  2. Click Check Tables
  3. If errors found, click Repair Tables
  4. Or use phpMyAdmin Repair function

Memory Limit Errors

Error

Fatal error: Allowed memory size exhausted

Increase PHP memory limit:

In wp-config.php add:

define('WP_MEMORY_LIMIT', '256M');

Or contact hosting to increase limit.

Max Execution Time

Queries timing out:

Increase in wp-config.php:

set_time_limit(300);

Or adjust in php.ini:

max_execution_time = 300

Database Optimization

Improve performance:

  1. Go to Tools → Optimize Database
  2. Run table optimization
  3. Rebuild indexes
  4. Clear old session data

Missing Indexes

Slow queries due to missing indexes:

  1. Go to Tools → Database Health
  2. Click Check Indexes
  3. Add missing indexes automatically

Backup Before Fixes

Important

Always backup database before attempting repairs or optimizations.