What tells rational cohomology about integral cohomology?

Form two CW-complexes $X_f$ and $X_g$ by choosing attaching maps $f, g: S^3 \to S^2$ with Hopf invariant $H(f) = 1$ and $H(g) = 2$. Then, $H^*(X_f, \mathbb Q)$ and $H^*(X_g, \mathbb Q)$ are isomorphic as graded rings, but $H^*(X_f, \mathbb Z) = \mathbb Z[x_2]/(x_2^3)$ is not isomorphic to $H^*(X_g, \mathbb Z) = \mathbb Z[x_2, y_4]/(x_2^2 - 2y_4, y_4^2, x_2y_4)$.


Following Najib's suggestion, I'll promote my comment to an answer.

Here is an infinite family of examples of closed simply connected manifold with cells only in even dimensions with isomorphic rational cohomology rings but pairwise non-isomorphic integral cohomology rings.

First, consider $\mathbb{C}P^3$ as the set of complex lines in $\mathbb{C}^4$. We identify $\mathbb{C}^4$ with $\mathbb{H}^2$, where $\mathbb{H}$ denotes the quaternions. Each complex line in $\mathbb{C}^4$ can be enlarged to a quaternionic line in $\mathbb{H}^2$ buy multiplying by $j$ and taking the span of the two complex lines.

This determines a map $\mathbb{C}P^3 \stackrel{\pi}{\rightarrow} \mathbb{H}P^1 = S^4$. In fact, this map is a fiber bundle map with fiber $S^2$, so we have a bundle $S^2\rightarrow \mathbb{C}P^3\rightarrow S^4$.

Now, fix an integer $k\neq 0$. Let $g:S^4\rightarrow S^4$ be any map of degree $k$. Let $S^2\rightarrow E_k \stackrel{\pi_k}{\rightarrow} S^4$ denote the bundle obtained by pulling back $S^2\rightarrow \mathbb{C}P^3\rightarrow S^4$ along $g$.

Claim 1: $E_k$ has a cell structure with only even degree cells.

Proof: $S^2\times S^4$ certainly does as $S^2$ and $S^4$ individually have a decomposition into even degree cells. But the decomposition into cells for a non-trivial bundle is the same as for the trivial bundle, but with different gluing maps.

$\square$

Claim 2: The generator of $H^2(E_k)\cong\mathbb{Z}$ squares to $k$ times a generator in $H^4(E_k)\cong\mathbb{Z}$.

Believing this for a moment, its clear that the rational cohomology rings will be isomorphic (unless $k = 0$).

Proof: Let $x\in H^2(\mathbb{C}P^3)$ generate the cohomology ring. From the pull back diagram we have a commutative diagram of fiber bundles $\begin{array} SS^2 & \stackrel{id}{\longrightarrow} & S^2 \\ \downarrow & & \downarrow \\ E_k & \stackrel{\overline{g}}{\longrightarrow} & \mathbb{C}P^3 \\ \downarrow{\pi_k} & & \downarrow{\pi} \\ S^4 & \stackrel{g}{\longrightarrow} & S^4 \end{array}$

From the Gysin sequence for each bundle, we see the map $H^2(E_k)\rightarrow H^2(S^2)$ is an isomorphism, as is the map $H^2(\mathbb{C}P^3)\rightarrow H^2(S^2)$. By commutativity of the top square, we deduce that $\overline{g}^\ast(x)$ generates $H^2(E_k)$.

Now, let $y\in H^4(S^4)$ be generator. From the Serre spectral sequence, we see that $\pi^\ast(y)$ generates $H^4(\mathbb{C}P^3)$, so $\pi^\ast(y) = x^2$ and also that $\pi_k^\ast(y)$ generates $H^4(E_k)$.

Now, recalling that $\overline{g}^\ast(x)$ generates $H^2(E_k)$, we compute \begin{align*} \overline{g}^\ast(x)^2 &= \overline{g}^\ast(x^2)\\ &= \overline{g}^\ast(\pi^\ast(y))\\ &= \pi_k^\ast(g^\ast(y))\\ &= \pi_k^\ast(ky)\\ &= k\pi_k^\ast(y). \end{align*}

In other words, the generator of $H^2(E_k)$ squares to $k$ times a generator of $H^4(E_k)$.

$\square$