Welcome to Laracast.
Did you really run this command "sudo mysql -uroot -p blog" ?
Normally, "-p" asks you for a password ...
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
So I'm going through the Laravel 8 From Scratch series but am running into an issue with MySQL in episode 17 (Environment Files and Database Connections).
I'm currently on Windows 10 but running an Ubuntu environment in the Windows Terminal. When I try installing MySQL with homebrew (brew install mysql) and then I run mysql -uroot -p I get the following error:
-bash: /usr/bin/mysql: No such file or directory
I've looked into this issue a bit and found a few people saying you're supposed to start mysql first with brew services start mysql but when I try running this I get this error:
Failed to connect to bus: No medium found
Error: Failure while executing; `/home/linuxbrew/.linuxbrew/bin/systemctl --user daemon-reload` exited with 1.
Looking even further into this issue I found that people were saying you shouldn't be using homebrew to install mysql in an ubuntu environment but instead you should be using sudo apt-get install mysql-server. So I do this, then start mysql using sudo /etc/init.d/mysql start which works. But then when I run sudo mysql -uroot -p I run into the following error:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Here's the DB section of my .env file:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=blog
DB_USERNAME=root
DB_PASSWORD=
All commands I'm running are being run from the Laravel project directory /home/anthony726/my-laravel-blog in the Windows terminal.
If anyone has any insight on this issue I'd appreciate it a lot! I've been trying to solve this for 2 days straight with no luck.
Did you setup "access with password" AND the "root password"?
Have a look to this link
https://stackoverflow.com/questions/2995054/access-denied-for-user-rootlocalhost-using-passwordno
Please or to participate in this conversation.