title: Reset MySQL Password on Homestead
body: <p>I'm running Homestead via Vagrant for a local Laravel install. I logged into Homestead via ssh (<em>vagrant ssh</em>), and connected to MySQL using the host <em>localhost</em>, user <em>homestead</em>, password <em>secret</em>. I was able to connect successfully, and running <em>show databases;</em> tells me there's an information_schema database in there. I thought all was well and I could create a new database for my Laravel project and get going.</p>
  
  <p>Unfortunately, running <em>CREATE DATABASE mynewdb;</em> returned:</p>
  
  <p>ERROR 1044 (42000): Access denied for user 'homestead'@'localhost' to database 'mynewdb'</p>
  
  <p>I tried giving the homestead user some more privileges via:</p>
  
  <pre><code>GRANT ALL PRIVILEGES ON mynewdb.* TO 'homestead'@'localhost' WITH GRANT OPTION;
  </code></pre>
  
  <p>But get back a similar access denied message:</p>
  
  <pre><code>Access denied for user 'homestead'@'localhost' (using password: YES)
  </code></pre>
  
  <p>I tried a few other variations of that command, using '%' instead of 'localhost', for instance, but it seems like my homestead user just doesn't have the priviliges needed to administrate this db fully.</p>
  
  <p>I thought I should be able to simple restart the mysql service with the --skip-grant-tables flag, and then login as homestead or root and have full privileges. This also failed to work:</p>
  
  <pre><code>vagrant@homestead:~$ sudo /etc/init.d/mysql stop
  [....] Stopping mysql (via systemctl): mysql.servic[.ok 
  
  vagrant@homestead:~$ sudo /etc/init.d/mysql start --skip-grant-tables
  [....] Starting mysql (via systemctl): mysql.servic[.ok 
  
  vagrant@homestead:~$ mysql -h localhost
  ERROR 1045 (28000): Access denied for user 'vagrant'@'localhost' (using password: NO)
  vagrant@homestead:~$ mysql -h localhost -u homestead
  ERROR 1045 (28000): Access denied for user 'homestead'@'localhost' (using password: NO)
  vagrant@homestead:~$ mysql -h localhost -u root
  ERROR 1698 (28000): Access denied for user 'root'@'localhost'
  vagrant@homestead:~$ mysql
  ERROR 1045 (28000): Access denied for user 'vagrant'@'localhost' (using password: NO)
  </code></pre>
  
  <p>After those attempts, I logged in with homestead and secret, just to check and see if anything had changed:</p>
  
  <pre><code>vagrant@homestead:~$ mysql -h localhost -u homestead -p
  mysql&gt; create database mynewdb;
  </code></pre>
  
  <p>ERROR 1044 (42000): Access denied for user 'homestead'@'localhost' to database 'mynewdb'</p>
  
  <p>Finally, I noticed in my homestead.yml file that there was an entry that looked like this:</p>
  
  <pre><code>databases:
  - homestead
  </code></pre>
  
  <p>I modified this entry to:</p>
  
  <pre><code>databases:
  - homestead
  - mynewdb
  </code></pre>
  
  <p>And then rebooted the homestead VM:</p>
  
  <pre><code>vagrant halt
  vagrant up
  </code></pre>
  
  <p>And then tried again to create the new datbase with the homestead MySQL user. None of this did anything, access is still completely denied for the homestead user trying to do just about anything.</p>
  
  <p>Suggestions to gain access?</p>