[SOLVED] Tables can't be used when moving to a new database


#1

I’m trying to move my Piwik installation to a new server, moving my database too. I’m following the procedure of the documentation. I arrived at this stage:

during the installation process, you will be asked to provide the mysql server, login, password and table prefix. It is very important that you specify the same table prefix (by default, “piwik_”). Piwik will detect that the tables are present in the database and all your existing websites and reports will be automatically detected.

Piwik detects the tables, but the only solutions proposed are then:

  • go back to the previous page and define a new prefix for the tables
  • erase detected tables.

I don’t have the option to keep the tables.

What can I do? Erase the tables, complete the installation and then upload my old database again?
Thx


(Peterbo) #2

Copy over the /config/config.ini.php from the old server, edit the database credentials. Piwik should run correctly by then.

~Peter


#3

I get this error message:

Your Piwik configuration seems to be wrong. Delete config/config.inc.php and resume the installation or change the connection parameters.

SQLSTATE[HY000] [2005] Unknown MySQL server host ‘localhost:/tmp/mysql5.sock’ (1)

Of course this is my good MySQL server host.

Was it good to upload new Piwik files (I mean freshly downloaded from Piwik.org) or should I copy my Piwik files from the old server to the new one?


(Peterbo) #4

[quote=su1]

SQLSTATE[HY000] [2005] Unknown MySQL server host ‘localhost:/tmp/mysql5.sock’ (1)[/quote]

Was it good to upload new Piwik files (I mean freshly downloaded from Piwik.org) or should I copy my Piwik files from the old server to the new one?[/quote]

  1. Change ‘localhost:/tmp/mysql5.sock’ to “localhost” or the domain that resolves to your host
  2. This is OK.

~Peter


#5

Now I have this error message :

SQLSTATE[00000] [1045] Access denied for user: ‘myusername@localhost’ (Using password: YES)

I have rechecked username and password and they’re ok.

The previous name I used for my database (‘localhost:/tmp/mysql5.sock’) is the name I use for my Wordpress config, so maybe it’s the good one nevertheless?


(Peterbo) #6

[quote=su1]
I use for my Wordpress config, so maybe it’s the good one nevertheless?[/quote]

It is not. At least not for piwik. “Access denied for user” says that your DB credentials are wrong, but the connection to the DB is OK. “Unknown MySQL server host” states that more than your credentials are wrong.

Check the credentials for the database user.


#7

OK so I probably don’t know what “database credentials” means and where to find them. Is it in the config.ini.php file too?


#8

There’s not much in the config.ini.php file, and I’ve checked my credentials for the database user in this file, they’re good (if what I think they are is right).

If Piwik can perform the installation on a virgin database with this configuration, it means the problem is somewhere else, am I right?

And can it work if I install Piwik on a virgin database (like for a new installation) and then once it’s installed, I erase this new virgin database and copy the old database instead?

Edit: it worked :slight_smile: Maybe the documentation should be updated?