Thanks for such clear instructions. Checked my server's moodle version in version.php, it's 2014111007.08.
When I issue, "select name,value from mdl_config where name='version';" at mysql prompt, I get, "ERROR 1146 (42S02): Table 'moodle.mdl_config' doesn't exist." Same for, "INSERT INTO mdl_config (name,value) VALUES ('version','2014111007.08');"
When I issue, "show tables;" I get 328 rows. Top few pasted below. One of the tables is definitely mdl_config.
I tried, "select * from mdl_config;" and tried with a few other tables and get the same ERROR 1146 (42S02), table doesn't exist.
+----------------------------------+
| Tables_in_moodle |
+----------------------------------+
| mdl_assign |
| mdl_assign_grades |
| mdl_assign_plugin_config |
| mdl_assign_submission |
| mdl_assign_user_flags |
| mdl_assign_user_mapping |
| mdl_assignfeedback_comments |
| mdl_assignfeedback_editpdf_annot |
Permissions OK. Table names match file names from the 328 .frm files in /var/lib/mysql/moodle. That folder also has db.opt. The .frm files are mostly 9kb with some up to 18kb. Biggest is mdl_user.frm at 27kb. Entire folder is 2.86MB. The moodledata folder was 924MB and moodle folder, 507MB. My site was under 10 users.
I ran mysql_upgrade and I get the same "Table 'XXXX' doesn't exist" for all the tables in moodle.
This mess happened because during my Ubuntu upgrade from 14.10 to 15.04 I got disconnected and I couldn't restart the upgrade (and didn't know that the DB was NOT in moodledata...so my backups might be useless).
Tried to fix by following some online advice for hours...was having some kind of dependency problems. During that time I copied over the moodle DB folder to my pc via SFTP. I thought I had backed up properly so I then tried a few more things for hours and eventually purge and autoremove. Rebooted server, couldn't get in through anything but serial console. Got a copy of my entire directory and files before rebuilding server and moodle DB not in copy.
It's possible I messed up the DB when I was trying to fix my Ubuntu upgrade and before I copied over the DB folder. Or it got messed up during the upgrade.
Looking grim. I ran this at one point...maybe did something like it before copying over the DB.
$ sudo apt-get --yes autoremove --purge mysql-server-5.5
$ sudo apt-get --yes autoremove --purge mysql-client-5.5
$ sudo apt-get --yes autoremove --purge mysql-common
$ sudo rm -rf /var/lib/mysql /etc/mysql ~/.mysql
Is there any hope? At least I've learned a lot...