We derive the viscous current in the fully ionized two-fluid plasma to generate the solar magnetic field. The global magnetic field of the Sun can be simulated by the viscous current from the differential rotation inside the Sun. The field presents a structure with 6-polar. As the viscous current is very weak, the magnetic field intensity is only about G, which could be considered as the background field of the Sun. The theory is a start for the generation of solar magnetic field. The local strong magnetic field of the Sun is not considered in the paper.