Search code examples
phpmysqlmacoslaravelmamp

Access denied for 'root@localhost' (using password: NO)


I recently installed mac OSX. I installed latest version of mamp.

I was trying to setup my database, but i got this error.

Access denied for 'root@localhost' (using password: NO)

my .env file --

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=some
DB_USERNAME=root
DB_PASSWORD=

My MySQL port is 3306, Apache port is 80 (I changed it).

I don't change the password of PhpMyAdmin. But I get an error like this.

So I tried entering some password, then it is giving me same error with password using: YES

How can I fix it?


Solution

  • If you are using MAMP try this.

    DB_CONNECTION=mysql
    DB_HOST=localhost
    DB_PORT=3306
    DB_DATABASE=some
    DB_USERNAME=root
    DB_PASSWORD=root
    

    Open your MAMP There your will see 3 options 1. Preferences 2. Open WebStart Page 3. Start / Stop Servers

    Click second one [ Open WebStart Page]. It will open mamp info page. Under MySQL area you can see your database connection details.

    MAMP Start

    See your connection details

    Hope it will help you.