Miscellaneous

mysql command to set seeds

Re: mysql command to set seeds

by Danny Glin -
Number of replies: 0
I'll start with my usual warning about this not being heavily tested, and that there is still the potential to screw things up, though as long as you stick to table names that start with the right course, you shouldn't be able to break anything globally.

Also, this can probably also be done using wwsh, but I have no experience with that.

Here is a bash command using variables defined in the shell:

echo "update ${coursename}_problem_user set problem_seed=$seed where user_id='$userid' and set_id='$setid' and problem_id=$problemid" |mysql webwork


To use this, set $coursename, $seed, $userid, $setid and $problemid in the shell (or your script), then run the command.


In order to not have to enter a mysql password each time the command is run, you should create a .my.cnf file in the home directory of the user running the script with the following contents:


[client]

user=webworkWrite

password=[your_webworkWrite_password]


Let me know if any of this isn't clear.