A coffee machine with a leak preventing device includes a main body, a chamber for containing liquid and coffee particles, a grinding assembly for grinding coffee particles, and a driving mechanism for driving the grinding assembly. The chamber is provided in the main body and the grinding assembly is provided in the chamber. The driving mechanism is provided with a driving shaft. A driving shaft hole is provided in a bottom of the chamber. The driving shaft is detachably connected to the grinding assembly through the driving shaft hole. The leak preventing device is provided at a position corresponding to the driving shaft hole and the leak preventing device is arranged to close the driving shaft hole when the driving shaft is detached from the driving shaft hole. In addition, a working method for the coffee machine with the leak preventing device is also provided.