+ All Categories
Home > Education > Running SQL Queries on the Moodle Database

Running SQL Queries on the Moodle Database

Date post: 15-Apr-2017
Category:
Upload: college-development-network
View: 1,130 times
Download: 4 times
Share this document with a friend
18
Running SQL Queries on the Moodle Database An overview 18 November 2016
Transcript
Page 1: Running SQL Queries on the Moodle Database

Running SQL Queries on the Moodle DatabaseAn overview

18 November 2016

Page 2: Running SQL Queries on the Moodle Database

Tools available

• Moodle Adminer• Ad-hoc Database Queries• Configurable Reports • PHP MyAdmin

Page 3: Running SQL Queries on the Moodle Database

Moodle Adminer

• The ‘work horse’• SQL in, information out• Aimed at Admins• Powerful for large queries• Slick authoring of queries• Robust browsing of tables

• So what’s the catch?

Page 4: Running SQL Queries on the Moodle Database
Page 5: Running SQL Queries on the Moodle Database
Page 6: Running SQL Queries on the Moodle Database

Moodle Adminer

Great so I can edit the database directly?Technically speaking yes…

Page 7: Running SQL Queries on the Moodle Database

Moodle Adminer

Installation and set up

The plugin installs like any other Moodle plugin, in the local folder and can be found at Site Administration > Server

Top Tip: If your Database Server has multiple databases, consider using moodleuser or similar in your config.php(create if needed)

Page 8: Running SQL Queries on the Moodle Database

Moodle Adminer

Demo

SELECT fullname, shortname FROM mdl_course ORDER BY fullname ASC

Page 9: Running SQL Queries on the Moodle Database

Ad Hoc SQL

Installation and set up

The plugin installs like any other Moodle plugin, in the reports folder and can be found at Site Administration > Reports

Page 10: Running SQL Queries on the Moodle Database

Ad Hoc SQL

• Write once, run many• Great for delegating running of queries to curriculum

managers• Not 100% foolproof• Elegant• Easy to use• Timer and Email utilisation

Page 11: Running SQL Queries on the Moodle Database

Ad Hoc SQL

Page 12: Running SQL Queries on the Moodle Database

Configurable Reports

• Very user friendly• Elegantly formatted output• Can be applied at course level as a block

Page 13: Running SQL Queries on the Moodle Database

Configurable Reports

Installation and set up

The plugin installs like any other Moodle plugin, in the block folder and can be added at course level

Page 14: Running SQL Queries on the Moodle Database

PHP My Admin

Installation and set up

Installed as a fully fledged application at server level.

Page 15: Running SQL Queries on the Moodle Database

Managing the Databases

Dumps

We do this through command line

mysqldump –u root –p –h localhost moodle > dump.sql

-v (verbose mode)

Page 16: Running SQL Queries on the Moodle Database

Managing the Databases

Find and Replace

We do this through command line, but the replace tool is also useful

sed –i ‘s/moodle.westcollegescotland.ac.uk/moodle14.westcollegescotland.ac.uk/g’ ./dump.sql

(sed is a Linux tool)

Page 17: Running SQL Queries on the Moodle Database

Managing the Databases

Page 18: Running SQL Queries on the Moodle Database

Managing the Databases

Imports

We do this through command line too

mysql –u root –p –h localhost moodle < dump.sql

-v (verbose mode)


Recommended