The dynamical behavior of the entanglement and the squeezing in the system of two ions trapped in a lossy optical cavity is discussed, in which the vibrational mode of the first ion is coupled to the cavity field via a linear-mixing interaction and the vibrational mode of the second ion is coupled to the cavity field via an effective parametric interaction, respectively. It is found that when the effective strength ${r}_{1}$ of the coupling between the first ion and the cavity field is stronger than the strength ${r}_{2}$ of the coupling between the second ion and the cavity field, the motional state of the two ions develops into a robust two-mode mixed Gaussian entangled state and the two-mode squeezing of phonons appears. But the entanglement between the cavity mode and the vibrational mode of the second ion can only happen periodically in a small time range. When ${r}_{1}l{r}_{2}$, only the entanglement between the two vibrational modes appears but the two-mode squeezing does not exist. And the entanglement between the cavity mode and the motional mode of the second ion can also take place in a small time range.