Mysore is well connected with Bangalore by rail.
The railway station for most of the trains to Mysore from Bangalore is Bangalore City Jn ( Station Code : SBC).
Some of the trains, especially the ones pass via Bangalore halts at Yesvantpur Jn, Bangalore East (BNCE) , Bangalore Cant (BNC) , Whitefield (WFD) etc depends on the route. So based on where you are traveling from in Bangalore, you may find a station closer to you than, say the Bangalore city station.
By the way see it here if you are looking for the list of all trains between Bangalore and Mysore.
There are many daily trains, both express and the slower passenger, trains between Bangalore and Mysore. The express takes around 2½ to 3 hours. The passenger trains (like the Night Queen) takes around 4 hours.
Talking of the daily morning trains to Mysore, the earliest to leave Bangalore for Mysore is the Mysore Express (Train No: 16021), popularly called the Kaveri Express. This connects Mysore with Chennai via Bangalore.
You can catch this train from Bangalore City Jn, Cantonment (BNC), Bangalore east (BNCE), Krishnarajapurm (KJM) or even from Whitefield (WFD)
Keep in mind, the train gets split at Bangalore City Jn and only a 'truncated' train continues to Mysore. So when you get in see to that you are boarding the coaches that head to Mysore!
You need reservation , if you require sleeper berth or get the regular second class unreserved ticket.
The next train for Mysore is the Mayiladuturai Mysore Express (Train No: 16231), again a long distance train that connect Mysore with places in Tamilnadu like Thanjavur, Tiruchirapalli, Salem etc.
This train too halts at Bangalore East (BNCE), Bangalore Cant (BNC) and finally leaves Bangalore City Jn by 6am to arrive Mysore by 9.20am.
Hampi Express (Train No 16591) leaves Bangalore Jn by 6.30am and reaches Mysore Jn by 9.40am
The Tuticorin-Mysore express (Train No: 16236) leaves Bangalore City Jn by 7am and reaches Mysore by 10am.
The first passenger train to leave for Mysore is the Tirupati - Chamarajanagar Passenger (Train No: 56214) that passes via Bangalore and Mysore. Leaves Bangalore Jn at 7.30am and reaches Mysore by 10.50am.
Train Route: The route is through pretty scenic rural country side once, the train exits the Bangalore suburbs. Once the train leaves the city limits, you can see massive boulder strewn landscapes of Ramanagara. Further you can see on either sides wide swatches of Mulberry, Sugarcane , Rice and Millet fields of Ramanagara, Mandya and Mysore. As the train enters Mysore district, it crosses the River Cauvery at Srirangapatna island.
The train route is essentially Bangalore ->Ramanagara -> Mandya -> Srirangapatna ->Mysore. Stops varies depends on the train. Many express trains has a couple of stops between Bangalore and Mysore.
Bangalore to Mysore Train Ticket Fares: Bangalore to Mysore train fare varies anything from Rs60 (1USD) to Rs 835 (USD13), depends on the class and type of the train.
Non-ac sitting (2S) costs Rs75, for the express (like Chamundi Express) or Rs90, for the Super Fast Express (like Tippu Express).
AC Chair Car (CC) fare is about Rs255, including the reservation charges.
Sleeper class (SL) ticket costs about Rs 140. The Second AC (2A) sleeper fare is Rs 695. For Third AC (3A), the fare is Rs490.
The Chennai-Bangalore-Mysore Shatabdi Express has two classes, Executive class (EC) and Chain Car (CC). The EC fare is Rs 835 while the CC ticket costs Rs440. By the way this is the fastest train between Bangalore and Mysore.
There are many more trains that connect Bangalore and beyond with Mysore. See the full list of trains from Bangalore to Mysore with Train Timings and the list of morning trains from Bangalore to Mysore
Check with the irctc.co.in website for reservation , updated schedules and fares.