Accidentally deleted config/config.ini.php, how do I rebuild it?

Automatic update failed today with the 2.0.2 version and I boneheadedly replaced the WHOLE piwik folder—config and all—with the archive from github. If I try to reinstall, it seems to want to delete my databases rather than adopt them.

How do I rebuild the config/config.ini.php?

first you should reinstall the version you were before using, because Piwik cannot install itself into a new version if the database is still the old format. So after reinstalling the same version, you can upgrade to 2.0 safely.

Well, I was going from 2.0.0 to 2.0.2… if I tried to install 2.0.0, would it just take on the old database without issues?

During the install if you specify the same prefix tables, and DB info, it will ask you to reuse or delete tables. Choose to Reuse and it should work fine! cheers

It insists on either deleting the tables or having me change the table preffix. I checked the piwik_option table, trying to find some hint as to the version I should be trying to install (in case I was mistaken initally), and it seems to think that it IS a 2.0.2 Piwik—so the auto-update crashed after it touched up the database… when I tried to jumpstart 2.0.2 earlier it also wanted to flush everything or have me re-preffix a clean install.

Let’s try different approach. Create a file config/config.ini.php:


; <?php exit; ?> DO NOT REMOVE THIS LINE
; file automatically generated or modified by Piwik; you can manually override the default values in global.ini.php by redefining them in this file.
[database]
host = "127.0.0.1"
username = "root"
password= ""
dbname = "XXX"
tables_prefix = "piwik_"
adapter = "PDO\MYSQL"
charset = "utf8"

[superuser]
login = "root"
password = "098f6bcd4621d373cade4e832627b4f6"
email = "test@test.com"
salt = "3c8f9ca0a238644809fe11b64871e8a3"

replace with your info, then you can login with root and password test

Alright, that worked!

Thanks!

Hi Matthieu,

How to know what salt value is from my matomo?

Hi,

You should be able to set the Salt to any securely random string. The only changes should be that everyone is logged out and returning visitors are not redetected from before the change.

Thanks Lukas for the information. It’s quite useful!