Maximum principle for harmonic functions I know the following classical maximum principle for harmonic functions: 

If $\Omega \subset \mathbb{C}$ is open and connected and $u \in
 C^2(\Omega)$ is harmonic, then 
$u$ has maximum (or minimum) in $\Omega$ $\implies$ $u$ constant.

How can I prove that the theorem is true if the hypothesis is that $u$ has a local maximum (or minimum).
 A: If $u$ has a local maximum at $x_0 \in \Omega$, that means that there is an open neighbourhood $U\subset \Omega$ of $x_0$ such that $u\lvert_U$ has a global maximum at $x_0$. Since clearly $u\lvert_U$ is harmonic on $U$, by the form of the maximum principle that you already know, it follows that $u\lvert_U$ is constant.
The two harmonic functions $u$ and $v \colon z \mapsto u(x_0)$ hence coincide on a nonempty open set (namely on $U$), and since $\Omega$ is connected, and harmonic functions are real-analytic, the following identity theorem (the case $n = 2$ with the usual identification $\mathbb{C}\cong \mathbb{R}^2$) implies that $u \equiv v$ on $\Omega$, i.e. $u$ is constant.

Identity theorem: Let $W\subset \mathbb{R}^n$ a connected open set, and $f,g \colon W \to \mathbb{R}$ real-analytic. If there is a nonempty open set $V\subset W$ such that $f\lvert_V \equiv g\lvert_V$, then $f \equiv g$ on all of $W$.

Proof: It suffices to consider $g \equiv 0$, since $f\equiv g \iff f-g \equiv 0$. Consider the set
$$Z = \{ x \in W : \text{there is a neighbourhood } U \text{ of } x \text{ such that } f\lvert_U \equiv 0\}.$$
By its definition, $Z$ is an open subset of $W$ (if $x\in W$ and $U$ is a neighbourhood of $x$ such that $f\lvert_U \equiv 0$, then $y\in Z$ for all $y$ in the interior of $U$). Since $f$ is real analytic, we can also describe $Z$ as
$$Z = \{ x \in W : D^{\alpha}f(x) = 0 \text{ for all } \alpha \in \mathbb{N}^n\},$$
for the power series representation of $f$ about $x$,
$$f(y) = \sum_{\alpha \in \mathbb{N}^n} \frac{D^{\alpha}f(x)}{\alpha!}(y-x)^{\alpha},$$
vanishes in a neighbourhood of $x$ if and only if all coefficients vanish. By continuity of $D^{\alpha}f$, the set
$$Z_{\alpha} = (D^{\alpha}f)^{-1}(0)$$
is closed (in $W$) for every $\alpha \in \mathbb{N}^n$, and hence so is the intersection
$$Z = \bigcap_{\alpha \in \mathbb{N}^n} Z_{\alpha}.$$
Thus $Z$ is an open and closed subset of $W$, and since $W$ is connected, we have either $Z = W$ or $Z = \varnothing$. But $Z \neq \varnothing$ was part of the hypotheses of the theorem, so $Z = W$ and indeed $f \equiv 0$ on $W$.
A: Assume that you can reach the local maximal $M$ in $x_0$, then by the same argument as the maximal situation, you can find a neighbor $U$ of $x_0$, s.t. $u=M$ in $U$, so $W=\{x:u(x)=M\}$ is open. Moreover $\{x:u(x)\neq M\}$ is open. By connectedness of $X$, we much have $W=X.$
Maybe the following is better：

