Unable to perform this function "php artisan migrate"
-
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.
-
@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)
-
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=
-
@rb557 : Did you create a database name "root"?
-
@leokhoa No.. I am attaching the screenshot. Please have a look at it.
-
@rb557 : You must update your .env:
DB_DATABASE=todolist
-
I did it still the same error @leokhoa
-
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
-
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.
-
This post is deleted!
-
@leokhoa @rizaldywirawan Thanks for the help guys. I resolved the issue. its migrated now. thank you
-
Hola @rb557,
glad to hear that the migrate work. Can you tell us the solution?
-
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:
-
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
-
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 ..
-
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
.