<p>Take this case <a href="https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/</a> for example (suppose we need write to the database).
Is the data synced among each mysql isntance?
If not, if there is any way to do it?</p>

ovvvvverff
<blockquote>
  <p>Is the data synced among each mysql isntance?</p>
</blockquote>

<p><strong>Disclaimer</strong>: although question title is centered around mongodb this answer is directed to your actual question (given example StatefulSet and mysql).</p>

<p><strong>Yes.</strong> The StatefulSet in <a href="https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/" rel="nofollow noreferrer">the link you provided</a> is keeping one master pod and two read-only pods in sync.</p>

<p>Notes:</p>

<ul>
<li>Services are configured in such a way that any pod will handle read operation (both master and any read-only-slave) while write operation must be done by writing to master pod exclusively since read-only-slaves are configured (using ConfigMap) to reject write operations.</li>
<li>InitContainers are used in each pod to distinguish configuration between master and read-only-slaves, as well as to do initial data load on restart.</li>
<li>Each mysql pod is consisting of two containers: mysql and xtrabackup. xtrabackup is tasked with syncing data with the master.</li>
<li><p>As noted in the documentation:</p>

<pre><code>this is not a production configuration. 
In particular, MySQL settings remain on insecure defaults
to keep the focus on general patterns for running stateful applications in Kubernetes.
</code></pre></li>
</ul>
