[Koha-bugs] [Bug 1382] New: Koha fails to install when MySQL DB is on localhost

bugzilla-daemon at pippin.metavore.com bugzilla-daemon at pippin.metavore.com
Mon Jul 9 19:03:54 CEST 2007


http://bugs.koha.org/cgi-bin/bugzilla/show_bug.cgi?id=1382

           Summary: Koha fails to install when MySQL DB is on localhost
           Product: Koha
           Version: 2.2.9
          Platform: PC
        OS/Version: Linux - Gentoo
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Installation
        AssignedTo: mjr at ttllp.co.uk
        ReportedBy: dswhite42 at spambob.com
         QAContact: koha-bugs at nongnu.org


I'm trying to install Koha 2.2.9 on a Gentoo Linux box (kernel 2.6.20) w/MySQL
5.0.40 .  (I know MySQL 5 isn't fully supported yet, but I don't think this is
a v4-vs-v5 issue).

During the installation, I use the default of "localhost" for the database
host, then choose "kohaadmin" as my user, and (e.g.) "foobar" for a password.

Later, when the installer tries to create the database, I get back this
message:
---------------------------------------------------------
Creating the MySQL database for Koha...

ERROR 1045 (28000): Access denied for user 'kohaadmin2'@'localhost' (using
password: YES)

DBI connect('Koha:localhost','kohaadmin2',...) failed: Access denied for user
'kohaadmin2'@'localhost' (using password: YES) at
/usr/local/koha/intranet/modules/C4/Context.pm line 411
Can't call method "prepare" on an undefined value at
scripts/updater/updatedatabase line 1553.
Problem updating database...
---------------------------------------------------------

The database is created, but it's not being populated correctly due to some
permission problems.  Looking at my MySQL debug logs, I see this line:

GRANT ALL PRIVILEGES on Koha.* to 'kohaadmin' IDENTIFIED BY 'foobar'

Now, this syntax doesn't appear to be correct for either MySQL 4.1 or MySQL 5.0
.  According to both http://dev.mysql.com/doc/refman/4.1/en/adding-users.html
and http://dev.mysql.com/doc/refman/5.0/en/adding-users.html , if you want a
user to have localhost access, it's necessary to explicitly specify that in the
GRANT ALL PRIVILEGES string.  (the default GRANT string, which is used by
Install.pm, grants privileges to the user from any host OTHER THAN localhost.) 
So to fix this, I edited Install.pm and changed line 1803 from this:

system("$mysqldir/bin/mysql '-u$mysqluser' -e \"GRANT ALL PRIVILEGES on
".$database.".* to '$user' IDENTIFIED BY '$pass' \" mysql");

to these two lines:

system("$mysqldir/bin/mysql '-u$mysqluser' -e \"GRANT ALL PRIVILEGES on
".$database.".* to '$user'\@'localhost' IDENTIFIED BY '$pass' \" mysql");
system("$mysqldir/bin/mysql '-u$mysqluser' -e \"GRANT ALL PRIVILEGES on
".$database.".* to '$user'\@'%' IDENTIFIED BY '$pass' \" mysql");

Just thought I'd pass it along.




------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.





More information about the Koha-bugs mailing list