Up until today my Homestead was running quite alright.
This morning I had a homestead database open in Sequel Pro. While it was trying to read it, I tried to cancel it, and quitted the app.
I tried to reconnect to MySQL via Sequel Pro afterwards, it didn't work.
I tried provisioning vagrant reload --provision. I got an error at the end of this:
https://gist.github.com/gormus/f6dc6ba5311367b76fd6f89fe2b4cba5
When I SSH'ed into the box and run mysql, I got another error:
vagrant@homestead:~$ mysql
ERROR 1045 (28000): Access denied for user 'homestead'@'localhost' (using password: YES)
Meanwhile MySQL service is active and running:
vagrant@homestead:~$ sudo service mysql status
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2018-07-23 20:11:37 UTC; 28min ago
Process: 1154 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid (code=exited, status=0/SUCCESS)
Process: 663 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 1156 (mysqld)
Tasks: 28 (limit: 3531)
CGroup: /system.slice/mysql.service
└─1156 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid
Jul 23 20:11:32 homestead systemd[1]: Starting MySQL Community Server...
Jul 23 20:11:37 homestead systemd[1]: Started MySQL Community Server.
As last resort I wanted destroy the vagrant box and re-create it. However I got hit by another error (see below).
Right now, I cannot access to databases. I cannot even create backups of them. And not sure how to resolve this.
Somehow the database got corrupted, when I interrupted it while it was reading from it. Now not sure how to proceed. Suggestions?
homestead --version to show the version.)macOS Hig Sierra (10.13.6)
~/Homestead $ vagrant destroy -f
==> homestead-7: Running triggers before destroy ...
==> homestead-7: Running trigger...
==> homestead-7: Backing up mysql database drupal8...
homestead-7: Running: inline script
homestead-7: mysqldump: Got error: 1045: Access denied for user 'homestead'@'localhost' (using password: YES) when trying to connect
==> homestead-7: Trigger run failed
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.
Even the root access is denied:
vagrant@homestead:~/mysql_backup$ mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Looks like something has changed the mysql password for homestead user.
If you care about backing up your databases:
vagrant upIf you don't care about your DBs:
rm -rf .vagrantvagrant upI had similar problem also. I noticed that I do not have .my.cnf file in /root/.my.cnf path and /home/vagrant/.my.cnf. I run vagrant reload --provision and files was recreated. You can also just create this files manually with content
[client]
user = homestead
password = secret
host = localhost
Thanks @kierzniak. But that's not the case for me. I have both .my.cnf files in place.
And provisioning didn't help on that issue either.
I've been pulled away from this task, so, I'm yet to try @svpernova09 's recommendation. Hopefully soon...
Most helpful comment
I had similar problem also. I noticed that I do not have
.my.cnffile in/root/.my.cnfpath and/home/vagrant/.my.cnf. I runvagrant reload --provisionand files was recreated. You can also just create this files manually with content