My os is windows
Illuminate\Database\QueryException : could not find driver (SQL: select * from information_schema.tables where table_schema = blog and table_name = migrations)
at E:\Programme\Laravel Lab\blog\vendor\laravel\framework\src\Illuminate\Database\Connection.php:664
660| // If an exception occurs when attempting to run a query, we'll format the error
661| // message to include the bindings with SQL, which will make this exception a
662| // lot more helpful to the developer instead of just the database's errors.
663| catch (Exception $e) {
> 664| throw new QueryException(
665| $query, $this->prepareBindings($bindings), $e
666| );
667| }
668|
Exception trace:
1 PDOException::("could not find driver")
E:\Programme\Laravel Lab\blog\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:68
2 PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=blog", "root", "root", [])
E:\Programme\Laravel Lab\blog\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:68
Please use the argument -v to see more details.
first you need start your mysql server
then check your env configuration for your mysql, i think your password isn't root, but you put root in password.
some times password is empty. check it please.
Related
I'm trying to run some services on a ubuntu server using process() (from Symfony\Component\Process\Process)
$process = new Process(['systemctl', '--user', 'start', $serviceName]);
try {
$process->mustRun();
}
catch (ProcessFailedException $ex) {
Log::alert($ex->getMessage());
}
but I'm getting the following error:
The command "'systemctl' '--user' 'start' 'some_service_name.service'" failed.
Exit Code: 1(General error)
Working directory: /
Output:
Error Output:
Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>#.host --user to connect to bus of other user)
Any help would be much appreciated!
I figured it out, for anyone facing the same problem the argument "--machine=username#.host" was missing.
so the end result should be something like this:
$process = new Process(['systemctl', '--machine=USER_HERE#.host', '--user', 'start', $serviceName]);
try {
$process->mustRun();
}
catch (ProcessFailedException $ex) {
Log::alert($ex->getMessage());
}
(replace the USER_HERE with your user)
Im using laravel in manjaro linux.. if I excute php artisan migrate command it gives me this erro how I fix this. also Im already install xampp
thank you..
error :
Illuminate\Database\QueryException : could not find driver (SQL: select * from information_schema.tables where table_schema = nws and table_name = migrations and t able_type = 'BASE TABLE')
at /run/media/snake/Entertainment/VS/linuxTest/Nurses/NW/vendor/laravel/framework/src/ Illuminate/Database/Connection.php:664
660| // If an exception occurs when attempting to run a query, we'll format the error
661| // message to include the bindings with SQL, which will make this exception a
662| // lot more helpful to the developer instead of just the database's errors.
663| catch (Exception $e) {
> 664| throw new QueryException(
665| $query, $this->prepareBindings($bindings), $e
666| );
667| }
668|
Exception trace:
1 PDOException::("could not find driver")
run/media/snake/Entertainment/VS/linuxTest/Nurses/NW/vendor/laravel/framework/src/
lluminate/Database/Connectors/Connector.php:70
2 PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=nws", "root", "", [])
/run/media/snake/Entertainment/VS/linuxTest/Nurses/NW/vendor/laravel/framework/src/
Illuminate/Database/Connectors/Connector.php:70
Please use the argument -v to see more details.
Make sure you have installed Maria / MySQL and it's PHP driver.
sudo pacman -Syu mariadb mariadb-clients libmariadbclient
My solution is use localhost instead 127.0.0.1 in .env...
DB_HOST=127.0.0.1
to
DB_HOST=localhost
try this, worked for me...
I am new to Laravel and myphpadmin so I am assuming I am making a stupid mistake while entering parameters into my env file. Also, keep in mind that I am using a brand new copy of myphpadmin that was included with MAMP (I haven't altered username or password at all).
Here is my error:
Illuminate\Database\QueryException : SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = mysql an
d table_name = migrations)
at
/Users/christian/Desktop/lsapp/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
660| // If an exception occurs when attempting to run a query, we'll format the error
661| // message to include the bindings with SQL, which will make this exception a
662| // lot more helpful to the developer instead of just the database's errors.
663| catch (Exception $e) {
> 664| throw new QueryException(
665| $query, $this->prepareBindings($bindings), $e
666| );
667| }
Exception trace:
1 PDOException::("SQLSTATE[HY000] [2002] No such file or directory")
/Users/christian/Desktop/lsapp/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68
2 PDO::__construct("mysql:host=localhost;port=8080;dbname=mysql", "root", "", [])
/Users/christian/Desktop/lsapp/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68
Here is my env file:
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=8080
DB_DATABASE=lsapp
DB_USERNAME=root
DB_PASSWORD=
In your env file, try change to:
DB_HOST=127.0.0.1
DB_PORT=3306
Also are you sure mysql is running on 8080? Mine is normally 3306
8080 is your Apache port, despite it showing up in the url of your PHPMyAdmin, it is not the value you need to put in your .env
Your MAMP instalation should mention a seperate MySQL Port that you need to use for the DB_PORT value.
I would like to change the way queue exceptions of type "A queued job has been attempted too many times. The job may have previously timed out." are logged.
I tried adding the following to the \Exception\Handler::report() method but I still see these showing up as ERROR in my logs.
public function report(Exception $exception)
{
if ($exception instanceof \Illuminate\Queue\MaxAttemptsExceededException) {
try {
$logger = $this->container->make(LoggerInterface::class);
} catch (Exception $ex) {
throw $exception; // throw the original exception
}
$logger->warning($e);
return;
}
parent::report($exception);
}
I also get alerts to a Slack channel (the most annoying part) for these when the min level is ERROR. I want to transform it to a WARNING so I prevent that from happening.
$slackHandler = new SlackHandler(
config('slack.api_token'),
config('slack.channel'),
'Laravel Error',
true,
null,
Logger::ERROR,
true,
false,
true
);
Admittedly this is similar to another question I asked, but I appear to have implemented it wrong.
I am using dynamic connection in laravel 5.2
try{
$mt4connection = DB::reconnect('mt4db');
}catch(Exception $e){
echo "test";exit;
$e->getMessage();
}
it is throwing exception :
[PDOException]
SQLSTATE[HY000] [2003] Can't connect to MySQL server on '52.44.48.105' (4)
But not coming in catch block.
How can i handle this, Please help me.