I installed via brew on macos the package mysql@5.7 so that can work with Laravel, following the present documentation but I cannot access to mysql@5.7
$ mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
the documentation says
Database
If you need a database, try MySQL by running brew install mysql@5.7 on your command line. Once MySQL has been installed, you may start it using the brew services start mysql@5.7 command. You can then connect to the database at 127.0.0.1 using the root username and an empty string for the password.
I made a long research and found that is a really common problem but whatever thing I tried did not work
I launched mysqld
skipping flushing privileges but then cannot root as well with mysql -u root -p
I tried to run a php artisan cache:clear
I tried to use sudo -s to log as root
and other things that at the moment do not remember anymore(basically is 3 days I am busy)
I am really surprised that a framework as Laravel that should be easy, has this kind of problems that are not reported by the documentation tutorial nor laracast, I did not do nothing strange, just followed the guide
I saw a post where for this error was suggested to change password, but also in this case I went through some issue, so I had to combine different responses but now works I followed mainly this post but arrived to the point 5:
5 : modify your password your new password should be input in "()"
I had to deal with a change in mysql@5.7 namely if you do show tables
you see that there is not a password column anymore, so you get an error message that does not exist the column password,
so I just passed
update user set authentication_string=password('1111') where user='root';// please notice 1111 is the password you fill
as indicated in this other post
then I followed the other step indicated by the post, to flush privileges and quit
finally I started again the daemon with
$brew services start mysql@5.7
and $mysql -u root -p (herethepassword)
did not work so I did
$mysql --password=(herethepassword) --user=root
and worked