The magnetic and thermal properties of a ferrimagnetic mixed spin-1 and spin-2 cubic Ising nanowire are studied by using the Monte Carlo simulation. The influences of the nearest (JAB) and next-nearest neighbor (JA and JB) exchange interactions and the single-ion anisotropies (DA and DB) on the critical and compensation temperatures are illustrated. Moreover, the phase diagrams on the (temperature, anisotropy) plane are plotted for several values of JA/|JAB|. The system shows very rich and interesting behaviors, namely first and second order phase transitions, tricritical points and compensation phenomenon. Finally, the dependence of hysteresis loops on the anisotropies, the exchange interactions and the temperature is also investigated.