So your database crashed and it wont start? There can be many reasons behind that issue. Sometimes its just a bad luck (unfortunate error which brakes some file in database system).
This happen to me few times and I had to deal with this issue like you now. After all this could be no big deal at all. So what to do?

Laragan database does not start.

Unless you did not manually delete your data, or any important file from laragon/data folder you might be in luck. Perhaps it is enough to recreate your database file system and move the most important files to new database installation (don’t confuse with new laragon installation).

Some theory first.

You might not know but you don’t have to download anything. Laragon already have all the files necessary to recreate database main files. Those files are stored in laragon\bin\mysql:

Notice that I have probably more database folders than you because I wanted to run mariadb (mysql fork) instead regular mysql. So again… those are the files which can be used to regenerate database working installation under laragon\data\somedbnamedir. In my case somedbnamedir is equivalent of mariadb-10-6 or in your case I assume this would be default mysql folder.

So we know this much already… but how to deal with database crash? It is quite simple! Laragon generate those files automatically when it is lunched if… and only if those folder are not present. So as you might think all we have to do is to rename this broken folder to something else and then restart Laragon right? This is exactly what we need to do. So in my case i use mariadb-10-6 (you might need to do that for mysql folder):

* note the _ (renaming the main database folder). If you copy this file instead, the original folder will be present and for that reason laragon will not generate new files. Ps. Don’t forget to restart laragon.

If everything went well we should now have two folders:

* again notice that the folder without _ was just generated by laragon app (a fresh/empty mysql database server install). Great! So what next? As you probably think we need to move some files from old dir to new dir. Which is exactly what we need to do now.

Moving files from broken database dir to fresh install.

Now select all folders from old _mysql (in my case _mariadb-10.6) install and ibdata1 file and move them to new mysql (in my case mariadb-10.6) folder. See example below for broken _mysql folder:

Or example for broken _mariadb-10.6 folder:

* You might try to include some other files. Just remember to restart laragon before testing database. If that does not help you might consider renaming whole laragon folder installing fresh install of laragon then trying to migrate database files as in the above post.

Backup database in Laragon just in case it crashes!

Now you know that crash can happen at any point in time. What if the next crash will not be that easy to fix? Just in case backup your database – it cost nothing. To backup your working database simple copy your mysql folder (or any other database version like mariadb) and rename it, prepending it with date of creation. This way you will be covered at all the time. You can perform this backup every time you work on something important or when the deadline can not be moved.

To backup database simple copy and rename database folder

You might also want to read about:
Update installation of mysql / mariadb in laragon.

https://forum.laragon.org/topic/164/tutorial-how-to-add-another-mysql-version/3

0
Would love your thoughts, please comment.x
()
x