Mysql problem on install

hello, 3 days trying to install piwik without luck, I read the entire forum and tickets etc … and I see no solution style_emoticons/<#EMO_DIR#>/sad.gif .

Error while trying to connect to the MySQL database:
No entry is registered for key ‘db’

error in step 3

piwik version: Piwik 0.4.3

in the ftp config / files:

. htaccess
config.ini.sample.php
global.ini.php

it should have read the config.ini.php created?

thanks. style_emoticons/<#EMO_DIR#>/rolleyes.gif

no ideas?

http://forum.piwik.org/index.php?showtopic=1029

The most likely problem is that the login credentials are incorrect. It must be a MySQL user that already exists. Piwik doesn’t create the user or grant privileges.

If you’re using a 3rd party web host, you have to ask your sysadmin (or use the cpanel) to create the MySQL user.

Hey guys - I had a problem like this when I was installing for the first time on my localhost - I had mySQL as part of XAMPP, but had never actually used it yet… Tried messing around with the mySQL my.ini file but that didn’t work - this however seems to:

I created a user for the account using this:

In shell / cmd :
Navigate to the mysql bin directory,

type:
mysql --user=root mysql

then, you should be in mysql so:
CREATE USER ‘username’@’%’ IDENTIFIED BY ‘password’;

followed by:
GRANT ALL PRIVILEGES ON . TO ‘username’@’%’ WITH GRANT OPTION;

where username and password are the ones you want to use

then try step 3 again with those details.

A

I got lucky, so I’m going to share before I forget how I did it…

My hosting service is Dreamhost and when I created a MySQL user they default the “Allowable Hosts” in the user profile to “%.dreamhost.com” or something.
Allowable Hosts is defined as “From what hosts (computers) may [username] connect to these databases? (One per line, use % as a wildcard.)” The also gave me my IP address. So I just replaced what they had with my IP address and it worked.

Who’d of thunk it…Now onto step 4.

So it’s in the config? Thanks for the info. I’m having the same issues right now actually.

Regards,
Liza

I am getting this error as well. I noticed during step 2, that I do not have a check mark though next to the PDO PHP function. Perhaps that will give someone else a clue as to if they are having the same error/issue.

I am getting with my host to see if they can enable that for me and then I am going to retry.

[quote=Scott Hack @ Oct 26 2009, 05:00 PM]I am getting this error as well. I noticed during step 2, that I do not have a check mark though next to the PDO PHP function. Perhaps that will give someone else a clue as to if they are having the same error/issue.

I am getting with my host to see if they can enable that for me and then I am going to retry.[/quote]

Once I installed the PDO PHP function this error message went away. Perhaps the install program should NOT let you continue if that isn’t installed? At first I thought I only needed MYSQL or the PDO installed. Hope this helps someone else out.

I too had the same problem. Seeing no solution, I looked in the code.

The failure is when loading the PDO drivers.

PDO::getAvailableDrivers() to be exact.

The reason, and why a “good tech support” can fix it, is the extension=php_pdo.dll MUST come before the extension=php_pdo_mysql.dll in your php.ini file.

If not, no worky.

To test if this is your problem, do a phpinfo() and check the PDO section. If you don’t see the mysql driver, then fix your php.ini, restart your server, reload the phpinfo(), and check the PDO again. Should be there now.

Your welcome.

I’m getting this error too. Any idea what it could mean if you’re using mysqli instead of PDO?

Is there an easy way in Piwik to debug this process? Find out EXACTLY where it’s dying? I tried to do some in installation\Controller.php but never got anywhere.

I added this: lists.piwik.org/pipermail/piwik-svn…ber/001029.html
into Controller.php, but it didn’t give me any more info.

[quote=mrdleigh @ Nov 17 2009, 07:35 PM]I’m getting this error too. Any idea what it could mean if you’re using mysqli instead of PDO?

Is there an easy way in Piwik to debug this process? Find out EXACTLY where it’s dying? I tried to do some in installation\Controller.php but never got anywhere.

I added this: lists.piwik.org/pipermail/piwik-svn…ber/001029.html
into Controller.php, but it didn’t give me any more info.[/quote]

I had the same problem. I had to create my piwik DB manually (using phpMyAdmin) and then supplied the new DB name to the Piwik installer. That worked fine and I was able to move forward.

[quote=kiwip @ Aug 11 2009, 07:43 AM]Same problem here, installation fails in step 3 with the message „Error while trying to connect to the MySQL database: No entry is registered for key ‘db’“ (whatever that means, it’s not in the MySQL error list).

  • Piwik 0.4.3
  • Apache/PHP/Piwik has write access to all directories the installation requested, i.e. config/ and tmp/ (obviously, as I did pass steps 1 and 2).
  • There are only config/config.ini.sample.php and config/global.ini.php, no config/config.ini.php.
  • Neither ;unix_socket=/sock/et/path nor localhost;unix_socket=/sock/et/path as database host help (and I wonder why I would need that anyway, socket path is defined in MySQLs/PHPs setup).
  • No error message in Apache’s error log.
  • I can login using the user/password using MySQLs command line tool.
  • It neither works without the to-be-created Piwik database, nor with it (created manually).

Thanks for any help.[/quote]

My issue is similar.

  • Piwik 0.4.5 and all of the above.
  • I manually created the user and database and can connect to them.
  • I only have mysqli installed, not pdo and pdo_mysql. According to the documentation this should be OK.

Can someone maybe provide a small script that just tries to make the connection (with mysqli) so this can be more easily debugged?

EDIT: this code works on my machine

<?php $link = new MySQLi('localhost', piwik', 'my_password', 'piwik'); if (!$link || mysqli_connect_errno() != 0) { echo "Epic Fail ", mysql_connect_error(); exit; } ?>

EDIT 2: If i apply dev.piwik.org/trac/changeset/1577 i get:

Error while trying to connect to the database server:
The PDO extension is required for this adapter but the extension is not loaded

Whitedog,
That piece of code that you say “works” - where did you put it? Does that mean it worked all the way to the END of the install (looking at your 2nd EDIT)?

On my situation. I’m on a 3rd-party hosting platform (POWWEB) that does your MYSQL users for you. It creates the database and the user for that database. That user has all power for that database but I don’t believe it can do any GRANTs. On a different platform that I have control over (I still need to get it to work on POWWEB), I created a database and I then created a user and gave him all rights IN THAT DATABASE. The Piwik install still failed. BUT, when I gave him all GLOBAL rights, the install worked (I chose mysqli). Perhaps there is an issue with expected rights/permissions?

It makes me wonder…is there a way I could simply create the whole database ahead of time (empty or initially populated)…a pseudo-manual install?

The database user must exist ahead of time with CREATE, ALTER, … privileges.

If the database user doesn’t have CREATE privilege for new databases, you need to create the database ahead of time (eg via cpanel).

On the Piwik Installation database setup form, supply the above information, and Piwik will use an existing database, create the tables/indices.

In the 3rd party hosting situation, the database exists. I can create tables with the user, etc., but the permissions are ONLY for that database and I’m guessing the user can’t grant any permissions to another user. Should any of that matter? With the “ALTER”, what is being altered…simple database objects?

[quote=mrdleigh @ Nov 27 2009, 06:13 AM]Whitedog,
That piece of code that you say “works” - where did you put it? Does that mean it worked all the way to the END of the install (looking at your 2nd EDIT)?

On my situation. I’m on a 3rd-party hosting platform (POWWEB) that does your MYSQL users for you. It creates the database and the user for that database. That user has all power for that database but I don’t believe it can do any GRANTs. On a different platform that I have control over (I still need to get it to work on POWWEB), I created a database and I then created a user and gave him all rights IN THAT DATABASE. The Piwik install still failed. BUT, when I gave him all GLOBAL rights, the install worked (I chose mysqli). Perhaps there is an issue with expected rights/permissions?

It makes me wonder…is there a way I could simply create the whole database ahead of time (empty or initially populated)…a pseudo-manual install?[/quote]

That’s just a snippet i used (in a new php file) to test if mysqli “works”.
To clarify: i’m not using shared hosting, I have a dedicated server. I actually recompiled php last night to include mysqli. I do not have PDO and PDO_mysql installed.

My assumption is that pdo is not actually needed to run Piwik but that the installer still uses PDO to create the tables etc. I could be completely off offcourse style_emoticons/<#EMO_DIR#>/smile.gif

Ok. Thanks for the clarification. Interesting assumption about PDO being used to create the tables. So, please test with your new re-compiliation of PHP to see if it installs with just mysqli.

It doesn’t. When i wanted to install Piwik it told me i needed either PDO or mysqli. So I recompiled php and was able to get to the db creation part, where I am now, and getting the same error as most of you.

The fact that i get an error about PDO (after applying the patch, see above) is what leads me to assume PDO is used in the instalation part.

Piwik 0.5 is expected to be released real soon now. We’ve made fixes and improvements to the installer.