title: "chown mysql:mysql /data/tmp" command
body: <p>I am on a Linux <strong>ubuntu</strong> machine with <strong>MySQL</strong> installed.</p>
  
  <p>If there is a <strong>MySQL</strong> installation on a <strong>Ubuntu</strong> machine, I saw some people doing the following thing: </p>
  
  <pre><code>sudo chown mysql:mysql /data/tmp
  </code></pre>
  
  <p>I get confused, I know the meaning of the above command, which is to change the owner of <code>/data/tmp</code> to user '<code>mysql</code>' and change the group of it to '<code>mysql</code>' group.</p>
  
  <p><strong>But (my questions):</strong></p>
  
  <p><strong>1.</strong> Why would one run the above command?  If I create a table in <code>my_db</code> database, by default, there will be <code>.frm</code>, <code>.MYD</code>, and <code>.MYI</code> files (data files) be created <strong>automatically</strong> by <strong>MySQL</strong> under <code>/var/lib/mysql/my_db/</code> . So, does the above command changes the default MySQL data directory to <code>/data/tmp/</code> instead of <code>/var/lib/mysql/my_db/</code>?</p>
  
  <p><strong>Basically, I would like to know the purpose and effect of the above command.</strong> (better with examples)</p>
  
  <p><strong>2.</strong> Where does the 'mysql' owner and group come from? Does the installation of MySQL on a Linux machine automatically create the 'mysql' user and group? or People need to manually create a <code>mysql</code> account for the linux machine?</p>