Unable to perform this function "php artisan migrate"


  • | 1515 points

    I am unable to launch the homestead in the database of Laragon. It gives me the following error. "SQLSTATE[HY000] [1045] Access denied for user 'homestead'@localhost' <using password: no>
    Also can anyone explain me how to connect the mysql server to Laravel from laragon terminal.

    Thanks in advance.


  • administrators
    | 93974 points

    @rb557 : In Laragon, the default username of MySQL is:
    root

    with no password.
    Note: You can generate a secure root password in (Menu > MySQL > Generate root password)


  • | 1515 points

    Thanks but I still got the same message "SQLSTATE[HY000] [1045] Access denied for user 'root'@localhost' <using password: no>
    I wrote this on my .env
    DB_CONNECTION=mysql
    DB_HOST=127.0.0.1
    DB_PORT=3306
    DB_DATABASE=root
    DB_USERNAME=root
    DB_PASSWORD=


  • administrators
    | 93974 points

    @rb557 : Did you create a database name "root"?


  • | 1515 points

    @leokhoa No.. I am attaching the screenshot. Please have a look at it.
    0_1515137035860_upload-d511e5a1-96f2-4cbf-a134-beea2e96d02a

    0_1515137063493_upload-c6e794a0-b251-40c0-af5d-cae5bd29a5f4


  • administrators
    | 93974 points

    @rb557 : You must update your .env:

    DB_DATABASE=todolist
    

  • | 1515 points

    I did it still the same error @leokhoa
    0_1515137341078_upload-9361012c-0e70-4d96-891d-601266da3e1c
    0_1515137367211_upload-090fc3e9-c38d-4a29-b2fa-069e8e49483c


  • | 2625 points

    Hi @rb557,

    Can you try to connect to MySQL using the cmd (just to make sure)?

    go to mysql.exe path (mine is: C:\laragon\bin\mysql\mysql-5.7.19-winx64\bin)

    open cmd there, and type

    mysql.exe -u root -p

    If your root account doesn't have password, then just press enter.

    If the MySQL say welcome to you, then can you try to retrieve some record?

    use todolist

    select * from [table_name]

    If you can enter the database and retrieve record from it, maybe there's a problem with your database config file. Can you please show your database config file?

    Thank you


  • | 1515 points

    Hi @rizaldywirawan
    I did what you said it went to my todolist database but I don't have the tables there..
    DB_CONNECTION=mysql
    DB_HOST=127.0.0.1
    DB_PORT=3306
    DB_DATABASE=todolist
    DB_USERNAME=root
    DB_PASSWORD=
    When I try to run the "php artisan migrate" command it still gives me the same error. Moreover the database name also is showing error in php.
    0_1515175985121_upload-eb74ce80-02b9-4374-8e6b-f994f8130923


  • | 1515 points

    This post is deleted!

  • | 1515 points

    @leokhoa @rizaldywirawan Thanks for the help guys. I resolved the issue. its migrated now. thank you


  • | 2625 points

    Hola @rb557,

    glad to hear that the migrate work. Can you tell us the solution?


  • | 1515 points

    the host was localhost instead of 127.0.0.1. @rizaldywirawan But I have two database one is todolist which got migrated and the other is test2 which is not getting migrated and throws me the following error. Please help me with this now: :(

    0_1515191062263_upload-d468b95c-003e-4cda-9b71-642cb699e5b3


  • | 2625 points

    Hola @rb557

    Update:

    can you post your migration file?

    hmm, what driver you use? I guess you have to uncomment some extension in php.ini file.

    for example, if you use pdo_odbc (to connect with Ms. Acess), you have to uncomment extension=php_pdo_odbc.dll

    maybe you use one of these.

    extension=php_pdo.dll
    extension=php_pdo_firebird.dll
    extension=php_pdo_informix.dll
    extension=php_pdo_mssql.dll
    extension=php_pdo_mysql.dll
    extension=php_pdo_oci.dll
    extension=php_pdo_oci8.dll
    extension=php_pdo_odbc.dll
    extension=php_pdo_pgsql.dll
    extension=php_pdo_sqlite.dll
    

  • | 1515 points

    Hi @rizaldywirawan

    Where can I find the php.ini file ?
    I am using mysql server and database is connected using Laragon terminal. I am not using Ms. Acess.
    My migration file is this ..
    0_1515205685702_upload-b8b801d8-a617-4cac-bd28-68a6a1d27daa


  • | 2625 points

    Hola @rb557,

    Do you use MySQL? I guess MySQL already active by default, unless you use another driver like Postgre or Mongo.

    But here is the path:

    C:\laragon\bin\php\php-7.2.0-Win32-VC15-x64.


Log in to reply
 

Looks like your connection to Laragon was lost, please wait while we try to reconnect.