## WeBWorK Problems

### Error message Course access

by Philippe Ben -
Number of replies: 11
I'm installing Webwork on ubuntu 12.04 whith the manual:
http://webwork.maa.org/wiki/Installation_Manual_for_2.5_on_Ubuntu_12.04#.UKvmAlG3zLc

An error message displays:

WeBWorK error

An error occured while processing your request. For help, please send mail to this site's webmaster (webmaster@localhost), including all of the following information as well as what what you were doing when the error occured.

Tue Nov 20 11:27:13 2012

Warning messages

Error messages

error instantiating DB driver WeBWorK::DB::Driver::SQL for table set_user: DBI connect('webwork','webworkWrite',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) at /opt/webwork/webwork2/lib/WeBWorK/DB/Driver/SQL.pm line 65
at /opt/webwork/webwork2/lib/WeBWorK.pm line 304

I don't know how to resolve this problem. Could you help me?
Thanks

### Re: Error message Course access

by Arnold Pizer -
Hi Phillipe,

Look at http://webwork.maa.org/wiki/Installation_Manual_for_2.5_on_Ubuntu_12.04#Global_Configuration

Specifically:

1. Search for $server_root_url and edit the three lines so that they read:$server_root_url   = "http://yourserver.yourschool.edu";
$server_userID = "www-data";$server_groupID    = "wwdata";

where of course you should edit yourserver.yourschool.edu appropriately.

If you are not setting up a server to be used by students, you might want to use "localhost" for the server_root_url.  Also be sure you have configured the other items.

Good luck,

Arnie

P.S.  This probably belongs in the installation forum

### Re: Error message Course access

by Philippe Ben -
Thank you but I use "localhost" for the server_root_url and the problem is the same. This is my message:

error instantiating DB driver WeBWorK::DB::Driver::SQL for table set_user: DBI connect('webwork','webworkWrite',...) failed: Access denied for user 'webworkWrite'@'localhost' (using password: YES) at /opt/webwork/webwork2/lib/WeBWorK/DB/Driver/SQL.pm line 65
at /opt/webwork/webwork2/lib/WeBWorK.pm line 304

Thank you

### Re: Error message Course access

by Jason Aubrey -
Phillipe,

The error message seems to be indicating that you have the wrong mysql password for the webworkWrite user. I recommend that you check in site.conf that it is the password you expect, and then try that password on the command line. In particular,

mysql -u webworkWrite -p

My guess is you won't get in, but if you do then:
mysql> use webwork;
mysql> show tables;

If you get that far, then this will list the tables in the webwork database. If you get this far and show tables returns 'empty set' it means that the addcourse script failed when you ran it to add the admin course, probably because it couldn't find the adminClasslist.lst file. But, I'll bet your password is just wrong and after you fix that everything will work. (Or at least you'll get past this particular error.)

Hope this helps,
Jason

### Re: Error message Course access

by Philippe Ben -
I tryed your commands. Password is good but when I want to "show tables", it returns "Empty set".
I think there is a problem when I create a course. I've create an other one (admin2). It appears in the http://localhost/webwork2/ page. When I try to access, the same error message displays.
So I would delete courses but when I use the command "delcourse admin2", this message appears:

error instantiating DB driver WeBWorK::DB::Driver::SQL for table set_user: DBI connect('webwork','webworkWrite',...) failed: Access denied for user 'webworkWrite'@'localhost' (using password: YES) at /opt/webwork/webwork2/lib/WeBWorK/DB/Driver/SQL.pm line 65
at /opt/webwork/webwork2/lib/WeBWorK/Utils/CourseManagement.pm line 508

PS: Sorry for my bad english ;-)

### Re: Error message Course access

by Jason Aubrey -

Here's a new hypothesis: Since you can connect with that password on the command line, but get an error when connecting from webwork, perhaps your password is both double quoted in site.conf and also contains characters that are special to perl.

In that case, perl will try to act on those characters and change the string before it is passed to msyql. So, if your password is double quoted in site.conf (e.g. "$3cr3t") then first change those to single quotes (e.g. '$3cr3t') and then try creating the admin course.

BTW, the fact that the course appears when you go to http://localhost/webwork2 is because the course directory is created under the courses/ directory even if the database tables are not created. In fact, the addcourse script will probably die if you don't delete the course directory before trying to recreate it, so you should delete the courses/admin and courses/admin2 directories before retrying this.

And, delcourse fails because it is also trying to connect to the database to delete the tables. A course is really just a directory structure plus some database tables, so since the tables aren't being created you can delete the course just by deleting the directory for the course.

Jason

### Re: Error message Course access

by Michael Gage -
Another thing that worries me is that the name of the table is set_user. Usually that is prefixed by a course name. admin_set_user.

### Re: Error message Course access

by Arnold Pizer -
Hi,

You might want to start over by deleting and recreating the webwork database. E.g.

mysql -u root -p

mysql> DROP DATABASE webwork;
mysql> CREATE DATABASE webwork;
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, LOCK TABLES ON webwork.* TO webworkWrite@localhost IDENTIFIED BY 'database_password';

where you should be very careful to replace "database_password" by the password that appears in global.conf or site.conf (depending on which version of WeBWorK you are installing).

Then just to be anal, check that you can login as webworkWrite as Jason has suggested.  Assuming that works, first remove the admin directory and all of it's subdirecties:

cd /opt/webwork/courses

and then create the admin course

$newgrp wwdata$ umask 2 $cd /opt/webwork/courses$ /opt/webwork/webwork2/bin/addcourse admin --db-layout=sql_single --users=adminClasslist.lst --professors=admin $exit I'm just coping commands from http://webwork.maa.org/wiki/Installation_Manual_for_2.5_on_Ubuntu_12.04 which I suggest you do as it reduces the chance of typo's. Good luck, Arnie In reply to Arnold Pizer ### Re: Error message Course access by Philippe Ben - Thank you. I will try your solutions but I've already deleted and recreate database...idem. I have a '@' in the password. Do you think it can be the problem? Thanks again In reply to Philippe Ben ### Re: Error message Course access by Danny Glin - The next thing I would check is that the password is typed correctly in global.conf. Make sure that in that file you have the line:$database_password="your_database_password";
(with the appropriate password filled in).

If this doesn't work, I suspect that the problem is as suggested earlier - that the system is getting caught up on a special character in your password.  To test this I would recommend changing the password to something that is just letters and numbers (to see if it works).  To do this, you would have to re-run the GRANT statements described in the manual with the new password, and change the password in your configuration file.

Hope this helps.

Danny

### Re: Error message Course access

by Arnold Pizer -
Hi,

If you use an @, at a minimum you need to use single quotes I think.

It would be safer to avoid special characters.