We use PHP and MySQL together without any problem on our website. and one day your PHP gives an error is database connection error this is not a big problem we can fix it easily. 


Database Connection Errors

  • Oops! Database is on a different URL
  • Can't Connect database to Localhost
  • Host Name does not match
  • Database Is Corrupted


Repairing a Database in phpMyAdmin

If you use PHPmyadmin with your database you can repair your DB but make sure to take a backup of your database and just follow these steps. 


  1. Log in to your web server(Cpanel).
  2. Click the phpMyAdmin icon
  3. Choose the affected database. If you only have one database, it should be chosen by default.
  4. In the main panel, you should see a list of the database tables. Click Check All.
  5. Choose the Repair Table from the drop-down menu.

Thanks, May above example help you.