Recently, I’ve been migrating sites to a new server. This included my Piwik installation for website statistics. In order to move Piwik I used mysqldump to backup the database, copied the sites files and restored them to a new server. When accessing Piwik for the first time after the migration I was greeted by the error:
Error: Piwik is already installed
Now, I know this is the only instance on my brand new server, and I know I restored the database correctly. I did some googling to find this is a common problem for migrating Piwik to a new server, but solutions proved to be lacking. In the end I moved the config.ini.php that contains the database connection to a backup location:
mv config/config.ini.php config/config.ini.php.old
I then re-ran the Piwik installation with the same details as I had in the original config file. This wiped my data, but after setup was finished I restored my backup from the original server again:
mysql -u root -p piwik < piwik.sql
Once I logged in all of my old data was available and Piwik was working again!
You may be interested in the following forum posts on the Piwik site: