diff --git a/django/db/backends/mysql/introspection.py b/django/db/backends/mysql/introspection.py
index fb97bc4..65f255b 100644
--- a/django/db/backends/mysql/introspection.py
+++ b/django/db/backends/mysql/introspection.py
@@ -1,6 +1,12 @@
 from django.db import transaction
 from django.db.backends.mysql.base import quote_name
 from MySQLdb.constants import FIELD_TYPE
+from MySQLdb import OperationalError
+import re
+
+# parses a foreign key constraint from show create table
+#                                                               fieldname              other_field other_table
+FKEY_PARSER = re.compile(r"\sCONSTRAINT `[^`]*` FOREIGN KEY \(`([^`]*)`\) REFERENCES `([^`]*)` \(`([^`]*)`\)")
 
 def get_table_list(cursor):
     "Returns a list of table names in the current database."
@@ -12,8 +18,58 @@ def get_table_description(cursor, table_
     cursor.execute("SELECT * FROM %s LIMIT 1" % quote_name(table_name))
     return cursor.description
 
+def _name_to_index(cursor, table_name):
+    """
+    Returns a dictionary of { field_name: field_index } for the given table.
+    Indexes are 0-based.
+    """
+    descr = get_table_description(cursor, table_name)
+    res = { }
+    i=0
+    for (name, type_code, display_size, internal_size, precision, scale, null_ok) in descr:
+        res[name] = i
+        i += 1
+    return res
+
 def get_relations(cursor, table_name):
-    raise NotImplementedError
+    """
+    Returns a dictionary of {field_index: (field_index_other_table, other_table)}
+    representing all relationships to the given table. Indexes are 0-based.
+    """
+    my_field_dict = _name_to_index(cursor, table_name)
+    constraints = [ ]
+    relations = {}
+    
+    try:
+        # This should work for MySQL 5.0
+        # Shouldn't we limit the select to table_schema?
+        cursor.execute(
+            """select column_name, referenced_table_name, referenced_column_name
+               from information_schema.key_column_usage
+               where table_name = %s
+                 and referenced_table_name is not null
+                 and referenced_column_name is not null""",
+            [table_name])
+        constraints.extend(cursor.fetchall())
+    except OperationalError:
+        # Fall back to `show create table`
+        # go through all constraints (== matches) and save these
+        cursor.execute("SHOW CREATE TABLE "+ table_name)
+        for row in cursor.fetchall():
+            pos = 0
+            while True:
+                match = FKEY_PARSER.search(row[1], pos)
+                if match == None:
+                    break
+                pos = match.end()
+                constraints.append(match.groups())
+
+    # handle constraints. (can't do this in the loop above since we need the cursor in both places)
+    for (my_fieldname, other_table, other_field) in constraints:
+        other_field_index = _name_to_index(cursor, other_table)[other_field]
+        my_field_index = my_field_dict[my_fieldname]
+        relations[my_field_index] = (other_field_index, other_table)
+    return relations
 
 def get_indexes(cursor, table_name):
     """
