[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[EP-tech] Re: Connecting to generated MySQL databases & searching by divisions with EPrints API
Hi Seb,
Tried with the database name, too - it still doesn't work.
Do you know how the Debian repository sets up MySQL? It looks like from the code that EPrints has set itself up with a super user, also, but I have been unable to find the details for this user within the codebase so far. Any hints would be much appreciated.
Best wishes, Rob
________________________________________
From: eprints-tech-bounces at ecs.soton.ac.uk [eprints-tech-bounces at ecs.soton.ac.uk] on behalf of Sebastien Francois [sf2 at ecs.soton.ac.uk]
Sent: 25 May 2012 12:04
To: eprints-tech at ecs.soton.ac.uk
Subject: [EP-tech] Re: Connecting to generated MySQL databases & searching by divisions with EPrints API
Hi Rob,
On 25/05/12 11:57, Berry, Rob wrote:
Hey,
Two quick queries:
# Connecting to MySQL databases
I've been trying to connect to the one of the MySQL databases generated by EPrints, as created through the Debian repository.
I'm using the details from /archives/<archive_name>/cfg/cfg.d/database.pl. However, MySQL returns the following:
robert at robert-uol:~$ mysql -u test -p
Enter password:
ERROR 1045 (28000): Access denied for user 'test'@'localhost' (using password: YES)
Perhaps try with the database name: mysql -u <username> -p <db_name> ?
Is there something I'm missing? The reason I wanted to actually do this is to check what data is in the database itself, as I was having another problem, detailed below.
# Searching by divisions with the EPrints API
I'm writing a script at the moment to move all prints from within one division into another. I have a function that is supposed to look up all prints in a given division (which I am passing as a string): https://gist.github.com/2787296
However, iterating through all the divisions in the subjects file, this function always returns a result set of zero prints. Is there something I'm doing wrong? Or is this something to do with the test data imported into EPrints 3? (This is why I wanted to have a look at the data on a database level.)
sub prints_for_division {
my ($session, $division) = shift;
Should be
sub prints_for_division {
my ($session, $division) = @_;
Otherwise only $session will get $_[0] and $division will remain "undef". "shift" only returns the first element of an array. Seb.