title: MySQL Initial Installation
body: <p>I know there are many, many threads on this, but hear me out before marking it as a duplicate. </p>
  
  <p>On an Raspberry Pi running stretch</p>
  
  <p>installed mysql </p>
  
  <blockquote>
    <p>sudo apt-get install mysql-server </p>
  </blockquote>
  
  <p>No errors</p>
  
  <hr>
  
  <p>pi@raspberrypi:~ $ mysql -u root</p>
  
  <p>ERROR 1698 (28000): Access denied for user 'root'@'localhost'</p>
  
  <hr>
  
  <p>Then I tried</p>
  
  <hr>
  
  <p>pi@raspberrypi:~ $ mysql_secure_installation</p>
  
  <p>NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
        SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!</p>
  
  <p>In order to log into MariaDB to secure it, we'll need the current
  password for the root user.  If you've just installed MariaDB, and
  you haven't set the root password yet, the password will be blank,
  so you should just press enter here.</p>
  
  <p>Enter current password for root (enter for none):</p>
  
  <p>ERROR 1698 (28000): Access denied for user 'root'@'localhost'</p>
  
  <p>Enter current password for root (enter for none):</p>
  
  <hr>
  
  <p>Now I had pressed enter, no password which should be the case since it is a brand new install</p>
  
  <p>Now, If I run the same install script with sudo</p>
  
  <hr>
  
  <p>pi@raspberrypi:~ $ sudo mysql_secure_installation</p>
  
  <p>NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
        SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!</p>
  
  <p>In order to log into MariaDB to secure it, we'll need the current
  password for the root user.  If you've just installed MariaDB, and
  you haven't set the root password yet, the password will be blank,
  so you should just press enter here.</p>
  
  <p>Enter current password for root (enter for none):
  OK, successfully used password, moving on...</p>
  
  <p>Setting the root password ensures that nobody can log into the MariaDB
  root user without the proper authorisation.</p>
  
  <p>Set root password? [Y/n]</p>
  
  <hr>
  
  <p>again, I used not password, just pressed enter</p>
  
  <p>And I can continue Down through setting up new password, disabling remote login, ect....</p>
  
  <p>However when it is all done, and I try and log in....</p>
  
  <hr>
  
  <p>Reload privilege tables now? [Y/n] Y
   ... Success!</p>
  
  <p>Cleaning up...</p>
  
  <p>All done!  If you've completed all of the above steps, your MariaDB
  installation should now be secure.</p>
  
  <p>Thanks for using MariaDB!
  pi@raspberrypi:~ $ mysql -u root -p
  Enter password:
  ERROR 1698 (28000): Access denied for user 'root'@'localhost'</p>
  
  <p>pi@raspberrypi:~ $</p>
  
  <hr>
  
  <p>I am sure I used the correct password (and have actually gone through this process a couple times)</p>
  
  <p>I can login to mysql with just sudo any no password, but this does not solve the problem of needing non sudo access</p>
  
  <hr>
  
  <p>pi@raspberrypi:~ $ sudo mysql
  Welcome to the MariaDB monitor.  Commands end with ; or \g.
  Your MariaDB connection id is 26
  Server version: 10.1.23-MariaDB-9+deb9u1 Raspbian 9.0</p>
  
  <p>Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.</p>
  
  <p>Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.</p>
  
  <p>MariaDB [(none)]></p>
  
  <hr>
  
  <p>I have gone through other examples of how to reset the password (--skip-grant-tables and such)  with no luck.  But even still I dont really want to RESET any passwords, I am starting with a fresh installation. </p>
  
  <p>I had seen somewhere that the default login for root wasnt any password, but was authenticated via a socket connection, but I have not been able to find out more about that</p>
  
  <p>Thanks for any help</p>