PDOException in Connector.php line 119: could not find driver - mysql

I installed Laravel 5.3 on CentOS 6.8. I updated php to 5.6.27, installed mysql-pdo, php-pdo.
In phpinfo(): PDO drivers: sqllite SQLite Library 3.6.20
But when I get data from DTB, I still get error:
PDOException in Connector.php line 119: could not find driver.
I did some search online, and one of solutions is:
uncommented ;extension=php_pdo_mysql.dll,
but I can't find it in my ect/php.ini file. when I add it manually, I got the message "
php startup unable to load dynamic library php_pdo_mysql.dll ...
" in php artisan migrate, and the error display in web is still the same.
Here's my env file:
APP_ENV=local
APP_KEY=base64:*somekey*
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=mydtb
DB_USERNAME=myusername
DB_PASSWORD=mypass
BROADCAST_DRIVER=log
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
PUSHER_APP_ID=
PUSHER_KEY=
PUSHER_SECRET=
My website address is 192.168.1.100 in local.
Can anyone help me with this?

Related

how can I match Laravel .env with XAMPP configuration settings?

I changed XAMPP configuration ports and localhost, when I ran old project it doesn't work so I need anyone to help me to match the .env with XAMPP configuration
the XAMPP window
Apache Service Window
MySQL Service Window
the .env file
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:kuAaczKFkzJWGNlZzrPpsBsmv+NNMCMPVwTsNYsbZyc=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=mobitech
DB_USERNAME=root
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DRIVER=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
If you want work Laravel with XAMPP, you need to check 2 things.
1- First your root folder must be laravel's public folder. So to do that click the Apache Config button and select the Apache httpd.conf option. Then find the DocumentRoot "C:/xampp/htdocs" and change with DocumentRoot "C:/xampp/htdocs/public"
2- Laravel's database options are in the .env file. XAMPP uses MySQL and its port is 3306. In the .env file DB_PORT key default value is also 3306. You you need to change port as your option (3308).
So when you enter the localhost or 127.0.0.1 probably it will work. But you had changed the http port as 1234, so you must enter https://localhost:1234 as an address.

Illuminate\Database\QueryException : SQLSTATE[HY000] [1044] Access denied for user ''#'localhost' to database 'forge'

I have downloaded a repo on github and created a database. I am trying to do migrations and am getting the below error
Error:
Illuminate\Database\QueryException : SQLSTATE[HY000] [1044] Access denied for user ''#'localhost' to database 'forge' (SQL: select * from information_schema.tables where table_schema = forge and table_name = migrations and table_type = 'BASE TABLE')
This is my .env file
APP_NAME=Tafuta
APP_ENV=local
APP_KEY=base64:0IDLuBYdTssK55SeeQTmCJ3GHlJXsR6BahTeenXaf90=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=TafutaM
DB_USERNAME=root
DB_PASSWORD=
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
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
Your .env is not taken into consideration for the variables.
It might be cause by something in your Vhost configuration like
A direct declaration of the variable in there that would override .env variables.
Another environment file is declared it it to be read. like .env.prod or .env.dev
Many people have this common error: It's because your database is not set.
Error say: '#localhost', then username = ''
database: forge, then database is named = 'forge'
If you dont see that parameters into your .env, its because file is not read, then you have to refresh your configuration:
php artisan config:cache
if you are using php artisan serve cancel it, and run again.
Now, if problem persists, you have to log with terminal or a database tool to your database, and make sure that the next parameters are the same:
DB_CONNECTION=
DB_HOST=
DB_PORT=
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=
Sometimes, people set incorrect port, or username or any(dont forget refresh configuration if you edit .env file).
You have to run the following command if you downloaded the source from GitHub:
composer install
cp .env.example .env
php artisan key:generate
php artisan config:clear
php artisan cache:clear
php artisan migrate

How to configure .env file in lumen?

I have tried searching and asking friends, the internet or on this site but all failed, I want to migrate database in lumen and this is my .env setting
APP_NAME=Lumen
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
APP_TIMEZONE=UTC
LOG_CHANNEL=stack
LOG_SLACK_WEBHOOK_URL=
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=db_twin
DB_USERNAME=root
DB_PASSWORD=root
UNIX_SOCKET=/Applications/MAMP/tmp/mysql/mysql.sock
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
so when I enter php artisan migrate, I got this error
In Connection.php line 664:
SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = db_twin and table_name = migrations)
In Connector.php line 70:
SQLSTATE[HY000] [2002] No such file or directory
Thanks for your answer

Remote Database is connecting

I am using laravel to build a project it was working then my server went offline(i am using another workstation just for database and other purposes)after the workstation restart then I couldn't login into my site it throws this error
SQLSTATE[HY000] [2002] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
my env file
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=ipaddress
DB_PORT=3306
DB_DATABASE=ssweb
DB_USERNAME=user
DB_PASSWORD=password
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=300
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=tls
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
It means you cant connect to the server. Check your connecting to the correct ip address and your firewall is configured to allow traffic.

InvalidArgumentException HELP Database [] not configured Laravel

Ijust cloned a laravel project from bitbucket and i'm using nginx server for my local devs.
But when i navigate to the url for my project(locally) i get this error.
Please help!
Create an .env file at the root. The content should be something like this
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=db
DB_USERNAME=root
DB_PASSWORD=mysql
BROADCAST_DRIVER=log
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
Replace all the database values above. Then run php artisan key:generate to generate your app key.