There are two Apps you need to download. The first is Rome2rio. This app allows you to input any point on earth as a starting point, and any other destination point, and it will spit out the best ways to get between those two points. It will also provide you links to the airlines, trains, buses, etc. that are shown as choices between the two points.
The second App is the App specifically for German trains. It is called DB Navigator. It is very easy to define two cities in Germany, and the date and time you need to travel, and it will give you the train options and costs.
Should you need to travel to/from France by train, try the SCNF App.
The train from the Mainz Hbf station to the Cologne Hbf station should run about 55-65 Euros. You can either take the express train or the more scenic, slower train that runs along the Rhine River, which is a very nice.
If you are going to do this on a mid-trip deviation, be sure you go into Flight Ops, Pre-Approvals, and Mid-Trip and Surface Deviations to get pre-approval for the train travel.