title: How to fix the error "unknown variable datadir" in mysql on raspbian?
body: <p>I want to safe the Databases on an Usbstick and not on my RaspberryPi.</p>
  
  <p>First I did:</p>
  
  <ul>
  <li><p>service mysql stop</p></li>
  <li><p>mkdir /media/pi/EMTEC/mysql</p></li>
  <li><p>nano /etc/mysql/my.cnf 
  and changed datadir=/media/pi/EMTEC/mysql</p></li>
  <li><p>cp -Rv /var/lib/mysql/* /media/usb4/mysql/</p></li>
  <li><p>chown -R mysql:mysql /media/usb4/mysql/</p></li>
  </ul>
  
  <p>which worked without problems</p>
  
  <p>My my.cnf:</p>
  
  <pre><code>[client-server]
  
  !includedir /etc/mysql/conf.d/
  
  !includedir /etc/mysql/mariadb.conf.d/
  
  datadir=/media/pi/EMTEC/mysql
  </code></pre>
  
  <p>When trying to restart the mysql service I receive:</p>
  
  <blockquote>
    <p>mysql: unknown variable 'datadir=/media/pi/EMTEC/mysql'</p>
  </blockquote>
  
  <p>How do I fix that error? </p>