The invention provides a hydraulic shifting mechanism of a gearbox. The hydraulic shifting mechanism comprises a shifting gear, a synchronizer, a shifting fork and a hydraulic oil cylinder that are mounted in a gearbox housing, wherein a shifting gear bearing is connected with an input shaft; the synchronizer is in spline fit with the input shaft; the shifting fork is connected with the synchronizer; a piston rod of the hydraulic oil cylinder is fixedly arranged in the gearbox housing; a cylinder barrel of the hydraulic oil cylinder is connected with the shifting fork; and the cylinder barrel can drive the synchronizer to slide on the input shaft through the shifting fork, so as to allow the synchronizer to be combined with or separated from the shifting gear. According to the hydraulic shifting mechanism of the gearbox, and the hydraulic oil cylinder driving the shifting fork to move is arranged in the gearbox housing, and the hydraulic oil cylinder and the gearbox are integrated, so that the assembling difficulty is reduced, the mounting is convenient, a space is saved, and no damage is caused easily. The cylinder barrel slides integrally to drive the shifting fork to move, and no deviation is produced in a moving process, so that the precision is high, the stability is good, the sliding stress of the synchronizer is balanced, the abrasion is little, the service life can be prolonged, and the shifting reliability can be improved.