Facing Error - php artisan serve not working in Laravel - php

I am trying to view my website on localhost but when i run php artisan serve command I'm facing this error.
In Connection.php line 664:
SQLSTATE[HY000] [1045] Access denied for user 'imperial_main'#'localhost' (using password: NO) (SQL: selec
t * from redirections where from = http://127.0.0.1/ limit 1)
In Exception.php line 18:
SQLSTATE[HY000] [1045] Access denied for user 'imperial_main'#'localhost' (using password: NO)
In PDOConnection.php line 40:
SQLSTATE[HY000] [1045] Access denied for user 'imperial_main'#'localhost' (using password: NO)
PS D:\xampp7.1.3\htdocs\backup-imperialride_ae>
My .env file
APP_NAME=Laravel
APP_ENV=local
APP_KEY==
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=test
DB_USERNAME=test
DB_PASSWORD=8mVNzfHR~*#s
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
My database
I want to view my website on localhost. plz, help me to figure out this problem and guide me on how can i solve this. I'll be very thankful to you

if you want to view your website on your local machine then you have to provide the database name in your .env file and the DB_username
APP_NAME=Laravel
APP_ENV=local
APP_KEY==
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=test //Your Database name
DB_USERNAME=test //By Default it should be root
DB_PASSWORD=8mVNzfHR~*#s //no need for password you can keep it blank
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

Related

Trying to make sure my credentials for Sendgrid with my API Key allows me access to send. message: Permission denied, wrong credentials

I believe I'm overlooking something when it comes to the areas where I would enter my API key and/or other fields I changed for this package from github, s-ichikawa/laravel-sendgrid-driver (https://github.com/s-ichikawa/laravel-sendgrid-driver). I've used the exact same API on another project and I'm pretty sure it's legit. I am also new to Laravel & Php, and I 'm hoping someone could see my mistake on one of the files I edited while going down the step for installing.
I get this exact error
Client error: POST https://api.sendgrid.com/v3/mail/send resulted in
a 401 Unauthorized response: {"errors":[{"message":"Permission
denied, wrong credentials","field":null,"help":null}]}
APP_NAME=bensonbraceletsAPI
APP_ENV=local
APP_KEY=base64:DtZBELx11fpEq7ZnEUyBgg6nqxY/fpdaU468HBUpAVg=
APP_DEBUG=true
APP_URL=http://bensonbraceletsAPI.test
LOG_CHANNEL=stack
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
MAIL_DRIVER=sendgrid
SENDGRID_API_KEY=MY_API_KEY_WAS_REMOVED
MAIL_MAILER=sendgrid
MAIL_MAILER=smtp
MAIL_HOST=smtp.sendgrid.net
MAIL_PORT=587
MAIL_USERNAME=justkeithcarr#gmail.com
MAIL_PASSWORD=SendEmailFromSendgrid
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=justkeithcarr#gmail.com
MAIL_FROM_NAME="${APP_NAME}"
services.php Below
'sendgrid' => [
'api_key' => env('SENDGRID_API_KEY'),
],

Problem with DB after cloning project from repo // PHP laravel

I have a problem with my Laravel project. After cloning the repo from git I did
npm install
composer install
php artisan migrate I have an error:
In Connection.php line 664:
SQLSTATE[HY000] [1045] Access denied for user 'root'#'localhost'
(using password: YES) (SQL: select * from languages where status =
1)
In Connector.php line 70:
SQLSTATE[HY000] [1045] Access denied for user 'root'#'localhost'
(using password: YES)
I've added few changes to .env file only
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:q/o7QZeznstW1iBW65t8F7usVPI1oA9osHGaCa6uONU=
APP_DEBUG=true
APP_URL=localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=8889
DB_DATABASE=newDB
DB_USERNAME=root
DB_PASSWORD=root
I am using mamp on mac os for my web environment.
Error Screenshot:
Try adding this to your .env file
DB_SOCKET=/Applications/MAMP/tmp/mysql/mysql.sock
I use MAMP too and always need this inside my .env files
Open the .env file and edit it.
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:q/o7QZeznstW1iBW65t8F7usVPI1oA9osHGaCa6uONU=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE= // Your Database Name
DB_USERNAME= // Yout Database Username
DB_PASSWORD= // Your Database Password
NOTE: If no password is set on the database, clear it DB_PASSWORD
This error basically comes from the after changes in the .env file:
SQLSTATE[HY000] [1045] Access denied for user 'root'#'localhost'
(using password: YES)
After completion of .env edit, must be clear cache: php artisan config:cache

SQLSTATE[HY000] [2002] Invalid argument (SQL: select * from information_sch ema.tables where table_schema = mamaput and table_name = migrations)

I set up my app on my virtual private server and after putting up my configuration file i get this error
(2/2) QueryException
SQLSTATE[HY000] [2002] Invalid argument (SQL: select * from `categories` where
`vendor_id` is null).
Here is my .env file
APP_NAME=Mamaput
APP_ENV=production
APP_KEY=base64:oJ7frlsRiP5V5QuFKTwVgpoBkUDze6mZZLwawqgayHk=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://mama-put.com
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=mamaput
DB_USERNAME=root
DB_PASSWORD=B0j0p#l3
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync
I am already frustrated cos everything seems okay. What am i doing wrong?
Usually means that you need to specify TCP/IP (1), or tell MySQL where your Unix socket is (2):
change localhost to 127.0.0.1
or
"mysql:host=127.0.0.1" or "mysql:host=localhost;port=3306"
"mysql:unix_socket=/var/run/mysqld/mysqld.sock"

How to connect Laravel application with MySQL with no username and password in Windows

I am using Laravel 5.5 and connecting with MySQL in Windows where I am not using any username and password in MySQL. It's showing an error when I am running php artisan migrate command :
SQLSTATE[HY000] [1044] Access denied for user ''#'localhost' to
database 'rebelute_test'
My .env file is here:
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:tSIeNfMf7bh6mxHuAHrhoaf+pzPxxFq69ABqlXZwtUw=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=127.0.0.1
APP_LOG=daily
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=rebelute_test
DB_USERNAME=''
DB_PASSWORD=''
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=log
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
The default username of database is root check it on DB_USERNAME variable

PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'homestead'#'localhost' (using password: YES)

I don't know what's happening. I run migration successfully which means that the database info is correct. But when i submit the signup form i get this error. Following is my .env file code.
APP_ENV=local
APP_KEY=base64:hRQre55GyKZGAx8u1GHZT/rg4m5O5Xln/+0BG8/qwdM=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=mindspace
DB_USERNAME=root
DB_PASSWORD=
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

Categories