Installation

Problems creating admin course

Problems creating admin course

by Adam Weyhaupt -
Number of replies: 6
Hi -

I'm trying to install Webwork 2.4 on Mac OS X 10.4.11. I think I've got everything installed OK (all the modules are OK, I think, and when I go to my webwork server I can see a page with no courses listed). After trying to create the administration course, I now see

Course administration

on the webwork page. Clicking on that, I get the following error:

error instantiating DB driver WeBWorK::DB::Driver::SQL for table set_user: DBI connect('webwork','webworkWrite',...) failed: Can't connect to MySQL server on 'localhost' (49) at /opt/webwork/webwork2/lib/WeBWorK/DB/Driver/SQL.pm line 65
at /opt/webwork/webwork2/lib/WeBWorK.pm line 286
Call stack

The information below can help locate the source of the problem.

in Carp::croak called at line 208 of /opt/webwork/webwork2/lib/WeBWorK/DB.pm
in WeBWorK::DB::init_table called at line 200 of /opt/webwork/webwork2/lib/WeBWorK/DB.pm
in WeBWorK::DB::init_table called at line 169 of /opt/webwork/webwork2/lib/WeBWorK/DB.pm
in WeBWorK::DB::new called at line 286 of /opt/webwork/webwork2/lib/WeBWorK.pm

If I look in global.conf, the database username is webworkWrite, and a password is set. I can login to mysql using "webworkWrite" and that password seem to have access to the "webwork" database.

Any thoughts? Is this possibly a permissions issue, or could you indicate to me how to test that?

Thanks for any help you can provide,

Adam
In reply to Adam Weyhaupt

Re: Problems creating admin course

by Gavin LaRose -
Hi Adam,

My experience is that the error message "Error instantiating DB driver... DBI connect... failed: Can't connect to MySQL server on 'localhost'" has meant that either the MySQL server isn't running or the password isn't set properly. If you're able to connect using the mysql client, that argues that neither of those are the problem.

So the next thing I'd check would be to see if there is anything odd with the connection definitions for mysql in WeBWorK: the $database_dsn and related definitions in global.conf, for example. Is there any chance that your mysql install requires non-networked (localhost) connections and WeBWorK is trying to talk to it through a networked (server-name) connection?

It could be that other error messages that will help debug will show up in your httpd/error_log, too.

Hopefully something in that will be useful,
Gavin
In reply to Gavin LaRose

Re: Problems creating admin course

by Adam Weyhaupt -
Hi Gavin -

Thanks for your reply. Following your suggestions, I've done some more tests, and here's what I know:

1) I have a working Moodle installation on this server, and Moodle is able to access mysql.

2) I have verified that the passwords in global.conf match the password for webworkWrite@localhost (by logging in at the command line). I've also changed both of those passwords.

3) I've enabled verbose logging on the mysql server, and when I get the error from webwork that it is unable to connect to the mysql server, NOTHING appears in the log file.

4) I've checked by using a small Perl script that I can at least connect to database using the dsn dbi:mysql:webwork:localhost using the username and password that I have in global.conf. I can also confirm that if I put a wrong password here, then I DO get an entry in the mysql log noting that access was denied.

5) I've checked the httpd error log, and there isn't anything helpful to me in there (by which I mean: everything in the log was also printed on the screen and included in my original reply).

From (3) and (4), I conclude that this is more than a password issue. For some reason, webwork just can't talk at all to the mysql server.

I've also got some more strange behavior to report, maybe this all will help make sense to the experts. When I looked at the webwork database, there were NO TABLES relating to the admin course that I thought I had created. I think (but can't remember!) that I created that course without using the correct group (www). I tried to simply recreate the course, and I'm getting this error message using the command line tool:

client153-167:/opt/webwork/courses adam$ sudo -u www addcourse admin --db-layout=sql_single --users=adminClasslist.lst --professors=admin
admin: course exists at /opt/webwork/webwork2/bin/addcourse line 239

Still, there are no tables in the webwork mysql database referring to the admin course. So, I tried creating another course using the same method as above, but called "testcourse". When I run this command, I got no error, the mysql database shows several tables related to "testcourse", and testcourse appears on the webwork page (on my webserver). But attempting to log in gives me the same error that it cannot connect to the mysql server.

Any more thoughts? I'm not an expert at any of this but just manage to plunk around, so it's very possible I'm just doing something wrong!

Thanks!

Adam
In reply to Adam Weyhaupt

Re: Problems creating admin course

by Thomas Hagedorn -
Hi Adam,

I just installed Webwork on a MacBook Pro with OS 10.5.2. I had a very similar problem with the creation of the admin course. The following worked for me:

1. I deleted the admin course in /opt/webwork/courses
2. I ran the command

addcourse admin --db-layout=sql_single --users=adminClasslist.lst --professors=admin

at the command line in /opt/webwork/courses. Please note that I was running as user hagedorn and I had given all the webwork files the user:group id of hagedorn:wwdata. The apache server is also running as hagedorn.


3. That's it. Now I can get into the admin course from the "Course Administration" page with no error. I have created another testcourse and everything seems to have worked fine.

-Tom
In reply to Adam Weyhaupt

Re: Problems creating admin course

by Michael Gage -
I tried to simply recreate the course, and I'm getting this error message using the command line tool:

client153-167:/opt/webwork/courses adam$ sudo -u www addcourse admin --db-layout=sql_single --users=adminClasslist.lst --professors=admin
admin: course exists at /opt/webwork/webwork2/bin/addcourse line 239

before you run this delete the directory ..../webwork/courses/admin
as Tom describes above. I'm also assuming that the server is running
as www and that you are storing your courses in .../webwork/courses
instead of in .../webwork/webwork2/courses (otherwise use the server's user
and your local directory paths.



Still, there are no tables in the webwork mysql database referring to the admin course. So, I tried creating another course using the same method as above, but called "testcourse". When I run this command, I got no error, the mysql database shows several tables related to "testcourse", and testcourse appears on the webwork page (on my webserver). But attempting to log in gives me the same error that it cannot connect to the mysql server.

Does the url
http://your.domain.name.edu/webwork2/testcourse

connect to the server? It just might work even if the admin course
is not installed.
Any more thoughts? I'm not an expert at any of this but just manage to plunk around, so it's very possible I'm just doing something wrong!

You've done a fine job of setting this up and a really excellent job of giving us information to help you. I'm sorry we haven't been able to diagnose the connection mixup right away. Two more things (which you have probably done) make sure that your database.conf agrees with database.conf.dist or that you understand why the discrepancies are there.

All the signs are that the webwork server can't log in to the mysql database but your check from the command line should have highlighted this. There
are subtle differences between webworkWrite and webworkWrite@localhost which might cause this , but I'm not an expert on mysql either. Try granting permissions to the webwork database inside mysql one more time.

Let us know if Tom's suggestions or one of mine has not been able to resolve the issue.

-- Mike

In reply to Michael Gage

Re: Problems creating admin course

by Adam Weyhaupt -
Mike, Tom, and Gavin -

Thanks very much for your help. I did manage to solve the problem.

in global.conf, my dsn was dbi:mysql:localhost, but needed to be dbi:mysql:localhost:3306. When the port number was specified, everything worked swimmingly. I'm not sure why this is the case, because in my command line script I was able to connect to the database without the port number.

Again, thanks so much for all of your help. I'm sure you'll hear from me again! Next task: learn webwork, then convince it to play nicely with Moodle...

Adam
In reply to Adam Weyhaupt

Re: Problems creating admin course

by Michael Gage -
Hi Adam,

Glad you figured out the connection problem and good luck with the rest. There has been some significant work done in connecting up moodle and WeBWorK, (see for example the recent news bulletin)

and we'd be delighted to have more help and ideas.

-- Mike