A MySQL or MariaDB database needs very little routine care: back it up, repair a table only when something reports it as damaged, and fix slow queries rather than "optimising" on a schedule. This page gives the quick steps for Domain India shared hosting, where you work in phpMyAdmin and your control panel.
Export a backup first. To repair a table marked as crashed, use Repair Database on cPanel's Manage My Databases page, or tick the table in phpMyAdmin and choose Repair table. Optimize table is only worth running after you have deleted a lot of data. For real speed, fix slow queries and indexes. You cannot change MySQL server settings on shared hosting.
InnoDB crash recovery, mysqlcheck on your own server and the server settings that still matter are all in Checking, repairing and optimising MySQL/MariaDB databases.
1. Back up before any repair
A repair rewrites table files. If it goes wrong, the backup is your way back. In phpMyAdmin, click the database, open Export, keep Quick and SQL, and save the file; see backing up a MySQL database with phpMyAdmin. Our cPanel and DirectAdmin servers also keep weekly JetBackup 5 backups, which include your databases.
2. Check and repair a table
- Export a backupas above.
- Check the tables.In cPanel, open Manage My Databases and use Check Database under Modify Databases. Or open phpMyAdmin, click the database, tick the tables and choose Check table from the With selected menu.
- Repair the damaged table.In cPanel, click Repair Database on the same page. In phpMyAdmin, tick the table named in the error and choose Repair table.
- Test your siteand check that recent content is still there.
Repair works on MyISAM tables. Most modern tables use InnoDB, which recovers itself after a crash and does not support REPAIR TABLE. If a repair fails, or the same table crashes again, open a ticket with the database and table names rather than retrying.
Old guides suggest deleting ibdata1 or the InnoDB log files. That can make every InnoDB table unreadable. On shared hosting you can't reach those files anyway; on your own server, follow the recovery steps in the full guide.
3. Optimise: when it helps and when it doesn't
Optimize table rebuilds a table to reclaim space. It helps after you have deleted a large share of a table's rows, for example after clearing years of WordPress post revisions or spam comments. It does not make a healthy database faster, and there is no need to run it every week.
Bigger gains come from the queries:
- Find the slow ones. On WordPress, the free Query Monitor plugin shows the slowest queries and which plugin made them.
- Index what you filter on. Columns used in
WHERE,JOINandORDER BYon large tables are the candidates.EXPLAINbefore aSELECTshows whether a query scans the whole table. - Remove what you don't use. Deleted plugins often leave tables and autoloaded options behind.
More in MySQL performance optimisation. The old advice to "turn on the query cache" is out of date: MySQL 8 removed it and MariaDB disables it by default.
4. From the command line
If jailed SSH is enabled on your account, mysqlcheck is available inside the jail on our cPanel and DirectAdmin servers (both run MariaDB). Jailed SSH access is available on every shared hosting plan (cPanel, DirectAdmin, Webuzo). It is off by default; ask support to enable it for your account. You log in with an SSH key. See enabling and accessing jailed SSH.
mysqlcheck -u your_db_user -p --check your_database
mysqlcheck -u your_db_user -p --repair your_databaseUse your database user, which starts with your account username, and type the password when asked rather than putting it on the command line.
5. WordPress clean-up
For WordPress, a maintained plugin such as WP-Optimize removes old revisions, spam and expired transients and can optimise the tables afterwards. Take a database backup first. To stop revisions piling up again, add define( 'WP_POST_REVISIONS', 5 ); to wp-config.php. The wider WordPress checklist is in Optimizing WordPress.
How do I repair a crashed MySQL table on Domain India hosting?
Export a backup in phpMyAdmin first. Then use Repair Database on cPanel's Manage My Databases page, or tick the table in phpMyAdmin and choose Repair table. If the repair fails or the table crashes again, open a support ticket with the database and table names.
Should I optimise my database every week?
No. Optimize table only reclaims space after large deletions. Regular backups and fixing slow queries do far more for a healthy database than scheduled optimisation.
Does Repair table work on InnoDB tables?
No. REPAIR TABLE works on MyISAM tables. InnoDB recovers automatically after most crashes; for a damaged InnoDB table, open a support ticket on shared hosting.
Can I change MySQL settings on shared hosting?
No. Server settings are shared by every account on the server. You can check, repair and optimise your own tables, and a VPS gives you full control of the database server.
Can I use mysqlcheck on Domain India shared hosting?
Yes, once jailed SSH has been enabled on your account by support. mysqlcheck is available inside the jailed shell on our cPanel and DirectAdmin servers; run it with your database user.
Ready to fix your database? Read Database troubleshooting for common errors, or open a support ticket if a repair doesn't work.
Send the domain, the database and table names and the exact error message. Never include your database password.
Open a support ticket