0

I am getting strange issue with mysql server after every 2 days I am working on moodle plugin development so as normally I installed moodle in my xampp htdocs folder before 2 days I was writing my plugin and it was working fine after weekend I open my system and now mysql is not running. This happened third or fourth times. I am attaching the error

error what I am getting

Xampp error screenshot

enter image description here

I even changed my machine to high configuration by thinking that the other machine could be out of memory etc.

So far I tried to backup the data but if I do backup then it doesn't have my moodle database everytime.

I know I should take backup time to time but problem is why this error is coming after every 2-3 days I tried running xampp as admin tried changing port etc. and tried various solution also but If I do copy from backup folder it will wipe out all my moodle database and I need to start if from scratch and Dont mark it as duplicate and I tried almost every solution but nothing working for me I even tried this one(Error: MySQL shutdown unexpectedly XAMPP)

Updated here is the actual error before doing anything which coming after every 2 daysOriginal error

Rohit -
  • 29
  • 4
  • 1
    Did you not read the messages you showed us? There is a db corruption!! Changing port number is not going to do anthing for that. Probably you shutdow the OS without closing XAMPP and that has corrupted the `db` database – RiggsFolly Feb 07 '23 at 10:42
  • This corrupted error came after I copied the data from backup folder but Its coming after every 3-4 day – Rohit - Feb 07 '23 at 10:47
  • Did you make a sanity backup before do ing anything? So while you only had the original error? – RiggsFolly Feb 07 '23 at 10:51
  • RiggsFolly I did but now I did a fresh installation of xampp and database . but I think I always turn off machine without turning off the server probably thats the reason but I hope next time it will not happen I will be careful . now I will delete the question as dont want to waste time but next time I will ensure to backup everything and post it with actual errors thanks for the time – Rohit - Feb 07 '23 at 11:02
  • @RiggsFolly please check the post. I updated it and see the error again came – Rohit - Feb 08 '23 at 19:53

2 Answers2

0

Because mysql.db is a system table used for authentication it aborts if it can't be opened.

Start the database with skip-grant-tables added the the configuration file.

After restarting run the SQL REPAIR TABLE:

REPAIR TABLE mysql.db EXTENDED

After this is complete. shutdown, remove the skip-grant-tables from the configuration file and start MariaDB again.

danblack
  • 12,130
  • 2
  • 22
  • 41
0

This is happening to me all the time when MySQL is shutting down, so this is how I fixed this error.

Go to xampp folder and open MySQL folder, there make sure you do backup of the data folder somewhere, then go to the backup folder in MySQL and copy all content except ibdata1 (or other files that are named like that) into your data folder. After this restart xampp and try to start MySQL service it should work.

NOTICE: Make sure you don't override ibdata1 in the data folder, you just need to copy everything from the backup folder except ibdata1, because in ibdata1 is all your saved data related to the database. If you do that you may lose all your data. That is why at the beginning I said to back up your data folder somewhere.

GomuGomu
  • 304
  • 2
  • 9