0

I have the data directory of an older MariaDB installation, containing various databases. I don't have MariaDB installed, and I don't know which version of MariaDB was installed before, but it's probably a year or two old.

I tried to reinstall MariaDB (v11.0.2) and using the same data directory, but getting an error of "Invalid data directory, ..., data directory exist and not empty".

How can I can reinstall MariaDB and use the existing data?

1 Answer 1

2

I presume, from your description, you're on Windows.

Install 11.0 using all defaults

Then:

  1. Stop service (net stop mariadb)

  2. change datadir entry in C:\Program Files\MariaDB 11.0\my.ini to point to your old datadir.

  3. Make sure that service can access that old data directory. For that, you might want to give service user (usually "NT Service\MariaDB") full access to the old datadir. This would be something like from elevated command line

 icacls "C:\path\to\old_datadir" /grant "NT SERVICE\MariaDB":(OI)(CI)F /T
  1. start service.

A word of caution - there is no 100% guarantee that service is going to start. You can be presented with something like "Crash upgrade is not supported", if database did not stop orderly last time. But that's another story for another time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.