My teacher needs to be able to view my databases in PHPMyAdmin however I am running on local host. How could I make it so he can connect to my localhost on another computer?
Is it not easier to just let him on your computer for a couple of minutes while you're in class? :) Or aren't you in class?
He teaches me computer science at school but he is assessing my DofE Learning (PHP) therefore it is on my home computer.
You can port forward port 80 on your router to your computer's IP, so it will be accessible from the outside.
Is it safe to do this?
In real life nothing is 100% secure. But if you are opening access only for a short time (only for assessment), you should be quite safe. Nevertheless consider the following:
Your phpmyadmin should be configured securely: create a user for your teacher, grant him only the necessary privileges, allow him to access only from predefined IP address (or range).
Also mysql should be installed securely (I hope you ran mysql secure installation script).
Make sure your webserver is setup securelly, too. You can google for tips about that (i.e. if you are using XAMP google for xamp security).
Shut down unnecessary services, especially insecure ones (ftp, telnet...).