When you create a database using CreateDB.sh, you also add a number of stored functions and procedures, which are system-wide, as opposed to just belonging to the wikidb database.
If you restore a database from another Deki, you do not get these added. You should always create a database with the correct version of CreateDB.sh before restoring a database.
If you did not, there is a workaround.
Change to /var/www/dekiwiki/maintenance and run the following commands. The first five lines set up variables (much as CreateDB.sh does with its command-line parameters) and you should set them to match your MySQL user, server, database, admin user and admin password, respectively. Take the code, add it to a file and call it update-sprocs.sh. Once you have that then you can execute from the console by running sh update-sprocs.sh
#!/bin/bash
# edit the db_ variable assignments before executing them
db_wiki_user=wikiuser
db_server=localhost
db_name=wikidb
db_admin_user=root
db_admin_password=password
MYSQL=`which mysql`
# create stored procs
cat archives/sprocs-*.sql | sed -e "s/{\$wgDBuser}/${db_wiki_user}/" -e "s/{\$wgDBserver}/${db_server}/" -e "s/{\$wgDBname}/${db_name}/" -e "s/{\$wgDBadminuser}/${db_admin_user}/" -e "s/{\$wgDBadminpassword}/${db_admin_password}/" | ${MYSQL} -u ${db_admin_user} -p${db_admin_password} -h ${db_server} ${db_name}
# create mysql FUNCTIONS
cat archives/funcs-*.sql | sed -e "s/{\$wgDBuser}/${db_wiki_user}/" -e "s/{\$wgDBserver}/${db_server}/" -e "s/{\$wgDBname}/${db_name}/" -e "s/{\$wgDBadminuser}/${db_admin_user}/" -e "s/{\$wgDBadminpassword}/${db_admin_password}/" | ${MYSQL} -u ${db_admin_user} -p${db_admin_password} -h ${db_server} ${db_name}
On Windows change to the Web directory of MindTouch and then to the maintenance directory, you will need GNU cat and GNU sed, both of which are attached to this page. Do the variable substitutions in the command line yourself, like so:
REM create stored procs
cat archives/sprocs-*.sql | sed -e "s/{\$wgDBuser}/wikiuser/" -e "s/{\$wgDBserver}/localhost/" -e "s/{\$wgDBname}/wikidb/" -e "s/{\$wgDBadminuser}/root/" -e "s/{\$wgDBadminpassword}/(passwordhere)/" | mysql -u root -p(passwordhere) -h localhost wikidb
REM create mysql FUNCTIONS
cat archives/funcs-*.sql | sed -e "s/{\$wgDBuser}/wikiuser/" -e "s/{\$wgDBserver}/localhost/" -e "s/{\$wgDBname}/wikidb/" -e "s/{\$wgDBadminuser}/root/" -e "s/{\$wgDBadminpassword}/(passwordhere)/" | mysql -u root -p(passwordhere) -h localhost wikidb
Replace values for wikiuser, localhost, wikidb, root and password as appropriate. You will need to put cat and sed somewhere in your path, or the maintenance directory itself.
| File | Size | Date | Attached by | |||
|---|---|---|---|---|---|---|
| cat-sed.zip cat and sed from GNUwin32 | 794.17 kB | 01:23, 2 Jan 2009 | crb | Actions | ||
| Images 0 | ||
|---|---|---|
| No images to display in the gallery. |
Copy the instructions as a *.sh file into the maintenance directory using Windows explorer
Then, in the shell:
add "exit" on the last line and save it
change the file rights to allow execution> chmod 755 sqlfix.sh
run the shell script> ./sqlfix.sh
Or afterwards, but before importing the sql file into it?
At the end of both commands it should read:
mysql -u root -p -h localhost -D wikidb
it would give me errors about my password being the database if i put it into the command. Also, the -D at the end is required to specify the database (wikidb is the default DB name).
I hope this helps anyone on a windows box =)