Bug 6276 - Access denied for user ...@localhost
Summary: Access denied for user ...@localhost
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Packaging (show other bugs)
Version: unspecified
Hardware: All Linux
: P5 - low normal (vote)
Assignee: Robin Sheat
QA Contact: Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-28 08:38 UTC by Serhij Dubyk
Modified: 2013-12-05 20:04 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Serhij Dubyk 2011-04-28 08:38:00 UTC
I create Koha-instance with command

sudo koha-create --create-db eng_marc21

Since I have several instances, I have slightly edited Apache-files
~~~~
<VirtualHost *:3003>
ServerName eng_marc21:3003
<VirtualHost *:3333>
ServerName eng_marc21:3333
~~~
Listen 3003
Listen 3333
~~~

Then when I try to access the web-installer I got this error:

Software error:
Access denied for user 'koha_eng_marc21'@'localhost' (using password: YES) at /usr/share/koha/lib/C4/Context.pm line 692.
Compilation failed in require at /usr/share/koha/lib/C4/Auth.pm line 33.
BEGIN failed--compilation aborted at /usr/share/koha/lib/C4/Auth.pm line 33.
Compilation failed in require at /usr/share/koha/intranet/cgi-bin/mainpage.pl line 23.
BEGIN failed--compilation aborted at /usr/share/koha/intranet/cgi-bin/mainpage.pl line 23.
For help, please send mail to the webmaster ([no address given]), giving this error message and the time and date of the error. 


To get rid of this error I had to execute the following commands (it is my grant.sh):

MysqlRootPassword=myrootmysqlpass
KohaDB=koha_eng_marc21
KohaDBuser=koha_eng_marc21
KohaDBpassword=mykohadbpass

sudo mysql -uroot -p$MysqlRootPassword $KohaDB -e "GRANT ALL ON $KohaDB.* TO '$KohaDBuser'@'localhost' IDENTIFIED BY '$KohaDBpassword';
flush privileges;"

sudo /etc/init.d/mysql restart
Comment 1 Robin Sheat 2011-04-29 00:57:45 UTC
Do you see any errors when you run koha-create?

The database creation process is:

CREATE DATABASE \`$mysqldb\`;
CREATE USER \`$mysqluser\`@'%' IDENTIFIED BY '$mysqlpwd';
GRANT ALL PRIVILEGES ON \`$mysqldb\`.* TO \`$mysqluser\`;
FLUSH PRIVILEGES;

I'm not sure what situation there would be where half of this works, but the grant fails however.
Comment 2 Serhij Dubyk 2011-05-05 08:43:53 UTC
(In reply to comment #1)
> Do you see any errors when you run koha-create?

Action log:

# koha-create --create-db test
Koha instance is empty, no staff user created.
Enabling site test.
Run '/etc/init.d/apache2 reload' to activate new configuration!
Restarting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
 ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
.
Starting Zebra server for test

All log from /var/log/koha/test/ are empty.

/var/log/syslog: only
May  5 10:55:01 Vognyk /USR/SBIN/CRON[21798]: (root) CMD (test -x /usr/sbin/koha-rebuild-zebra && koha-rebuild-zebra $(koha-list --enabled))
May  5 10:57:44 Vognyk Koha Zebraqueue [1924]: failed to connect to DB:
(but, maybe, it is not connected with koha-create)

#firefox http://127.0.0.1:2222/
Software error:
Access denied for user 'koha_test'@'localhost' (using password: YES) at /usr/share/koha/lib/C4/Context.pm line 692.
Compilation failed in require at /usr/share/koha/lib/C4/Auth.pm line 33.
BEGIN failed--compilation aborted at /usr/share/koha/lib/C4/Auth.pm line 33.
Compilation failed in require at /usr/share/koha/intranet/cgi-bin/mainpage.pl line 23.
BEGIN failed--compilation aborted at /usr/share/koha/intranet/cgi-bin/mainpage.pl line 23.

/var/log/koha/test/intranet-error.log:
[Thu May 05 11:25:58 2011] [error] [client 127.0.0.1] [Thu May  5 11:25:58 2011] VirtualShelves.pm: DBI connect('dbname=koha_test;host=localhost;port=3
306','koha_test',...) failed: Access denied for user 'koha_test'@'localhost' (using password: YES) at /usr/share/koha/lib/C4/Context.pm line 692
[Thu May 05 11:25:58 2011] [error] [client 127.0.0.1] [Thu May  5 11:25:58 2011] mainpage.pl: Access denied for user 'koha_test'@'localhost' (using pas
sword: YES) at /usr/share/koha/lib/C4/Context.pm line 692.
[Thu May 05 11:25:58 2011] [error] [client 127.0.0.1] [Thu May  5 11:25:58 2011] mainpage.pl: Compilation failed in require at /usr/share/koha/lib/C4/A
uth.pm line 33.
[Thu May 05 11:25:58 2011] [error] [client 127.0.0.1] [Thu May  5 11:25:58 2011] mainpage.pl: BEGIN failed--compilation aborted at /usr/share/koha/lib/
C4/Auth.pm line 33.
[Thu May 05 11:25:58 2011] [error] [client 127.0.0.1] [Thu May  5 11:25:58 2011] mainpage.pl: Compilation failed in require at /usr/share/koha/intranet
/cgi-bin/mainpage.pl line 23.
[Thu May 05 11:25:58 2011] [error] [client 127.0.0.1] [Thu May  5 11:25:58 2011] mainpage.pl: BEGIN failed--compilation aborted at /usr/share/koha/intr
anet/cgi-bin/mainpage.pl line 23.


I'm not very perfect with MySQL but why not use creation db and grant exactly as mentioned in
http://git.koha-community.org/gitweb/?p=koha.git;a=blob;f=INSTALL.debian;hb=HEAD ?
Comment 3 Owen Leonard 2013-03-26 15:31:52 UTC
This bug is two years old with no new comments. I'm assuming it is no longer relevant.