title: MySQL "ERROR 1698 (28000): Access denied for user 'root'@'localhost'"
body: <p>I've installed MySQL with the following version:</p>
  
  <pre><code>kurt@kurt-ThinkPad:~$ mysql -V
  mysql  Ver 14.14 Distrib 5.7.15, for Linux (x86_64) using  EditLine wrapper
  </code></pre>
  
  <p>I recall I did not set a password for the root user during setup. However, if I try to simply start it using the <code>mysql</code> command, I get the following error:</p>
  
  <pre><code>kurt@kurt-ThinkPad:~$ mysql
  ERROR 1045 (28000): Access denied for user 'kurt'@'localhost' (using password: NO)
  </code></pre>
  
  <p>Similarly, as a root user,</p>
  
  <pre><code>kurt@kurt-ThinkPad:~$ mysql -u root
  ERROR 1698 (28000): Access denied for user 'root'@'localhost'
  </code></pre>
  
  <p>I tried following the instructions on <a href="https://dev.mysql.com/doc/refman/5.5/en/resetting-permissions.html" rel="noreferrer">Resetting the Root Password: Unix and Unix-Like Systems</a>; I made the text file in my home directory, and from there tried to start the MySQL server with the <code>--init-file</code> option. However, I again get a permissions error:</p>
  
  <pre><code>kurt@kurt-ThinkPad:~$ mysqld_safe --init-file=mysql-init &amp;
  [1] 18340
  kurt@kurt-ThinkPad:~$ /usr/bin/mysqld_safe: 548: /usr/bin/mysqld_safe: cannot create /var/lib/mysql/mysqld_safe.pid: Permission denied
  2016-09-20T14:57:04.753720Z mysqld_safe Logging to '/var/log/mysql/error.log'.
  cat: /var/run/mysqld/mysqld.pid: Permission denied
  rm: cannot remove '/var/run/mysqld/mysqld.pid': Permission denied
  2016-09-20T14:57:04.780206Z mysqld_safe Fatal error: Can't remove the pid file:
  /var/run/mysqld/mysqld.pid
  Please remove it manually and start /usr/bin/mysqld_safe again;
  mysqld daemon not started
  /usr/bin/mysqld_safe: 135: /usr/bin/mysqld_safe: cannot create /var/log/mysql/error.log: Permission denied
  rm: cannot remove '/var/lib/mysql/mysqld_safe.pid': Permission denied
  </code></pre>
  
  <p>I have read about a similar error in <a href="https://stackoverflow.com/questions/15408643/cant-connect-to-mysql-server-cant-create-write-the-pid-file">Cant connect to Mysql server ; Can&#39;t create/write the pid file</a>, where the proposed solution is to assign the MySQL user to the <code>/var/run/mysqld</code> directory. However, if I try this I get "Operation not permitted":</p>
  
  <pre><code>kurt@kurt-ThinkPad:~$ chown mysql:mysql /var/run/mysqld
  chown: changing ownership of '/var/run/mysqld': Operation not permitted
  </code></pre>
  
  <p>Any ideas on how to get MySQL to work?</p>