I am using Laravel to connect to MySQL database and got this exception:
PDOException
SQLSTATE[HY000] [1049] Unknown database 'forge'
and this is my config.database.php
'mysql' => array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'laravel',
'username' => 'Anastasie',
'password' => 'A#Laurent',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
why is the error referring to PDO database? and why the forge database name? I have already changed it.
Should I do anything to tell Laravel that I am using MySQL database?
Update 1
I found this line
`protected $table = 'users';`
in my user.php file and I have changed it to
`protected $table = 'user';` because the table in my database is `user` not `users`
Update 2
I wrote this in my Route
Route::resource('users', 'UsersController');
and I added UsersController.php in my controllers folder
and inside UsersController.php I have this:
class UsersController extends BaseController {
/**
* Display a listing of the resource.
*
* #return Response
*/
public function index()
{
$users = User::all();
return View::make('users.index', compact('users'));
}
and I call this url http://localhost:8082/laravel/public/users/
I am using Windows 7 with Laravel 4.2
You have to clear the cache like that (because your old configuration is in you cache file) :
php artisan cache:clear
The pdo error comes from the fact Laravel use the pdo driver to connect to mysql
First you have to Create your related Database.
Then:php artisan cache:clear
Now run php artisan migrate:install
Hope your problem will get resolved.
Using phpMyAdmin (or whatever you prefer), I just created a database called "forge" and re-ran the php artisan migrate command and it all worked.
write
php artisan config:cache
in your terminal and it will be fixed
Sounds like you have an environment-specific config file somewhere that overrides the default database settings. Possibly app/config/local/database.php.
Note: Once it happened that I accidentally had a space before my database name such as mydatabase instead of mydatabase, phpmyadmin won't show the space, but if you run it from the command line interface of mysql, such as mysql -u the_user -p then show databases, you'll be able to see the space.
I had the same problem...
If you have set your DB name and username and pass correctly in .env file and its still not working run the blow code in terminal:(this will clean the caches that left from previous apps)
php artisan cache:clear
and then run the command php artisan serve again (if you are running it stop and run it again)
Stop the server then run php artisan cache:clear.
Start the server and should work now
Stop the server then run php artisan cache:clear.
Change .env file DB_PORT=3308 (3308 For me)
mysql port
I did all of them but didn't work, I find out should stop php artisan serve(Ctrl + C) and start php artisan serve again.
If you've used Homestead, make sure the database name in your .env file below
DB_DATABASE=homestead
Is the same as the value in your Homestead.yaml file.
databases:
- homestead
first clear your cache using this command
php artisan cache:clear
Then restart the server using this command
php artisan serve
In my case the error was due to incorrect port number (the error is definitely due to incorrect credentials i.e. host/port/dbname/username/password).
Solution:
right click on WAMP tray;
click (drag your cursor) on MySQL;
see the port number used by MySQL;
add same in your Laravel configuration:
.env file;
config/database.php.
Clear cache
php artisan config:cache
Run migration
php artisan migrate
Check your port in WAMP (it places on top of the phpMyAdmin) match with DB_port in the .env file.
My DB_port in .env is 3306. My server port in WAMP (phpMyAdmin) is 3308 - you should match them.
you need just create database or import your data by localhost phpMyAdmin and don't forget the name should be same named
Encountered this issue quite a few times, note that I'm running laravel via Vagrant. So here are the fixes that work for me:
Try again several times (refresh page)
Reload vagrant (vagrant reload)
You may try reloading your server instead of vagrant (ie MAMP)
OK, found solution.
In the file database.php, by default, it comes the "mysql" part:
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
],
all you need to do is change the values :
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
by your database name (you must create one if you dont have any) and by that database username
like this
'database' => env('DB_DATABASE', 'MyDatabase'),
'username' => env('DB_USERNAME', 'MyUsername'),
Make sure you do not have a duplicated .env file in the laravel folder. If it exists, delete it. Only keep the .env file.
You need to modify the name of the DB in the file .env (and if need in .env.example)
I solved my problem with this little correction.
In my particular case, I finally realised that my phpMyAdmin was using port 3308 while Laravel was attempting to connect through 3306. so my advice would be to ensure you have the correct connection string!
Here is my response to the problem described in the question.
in cmd write:
php artisan cache:clear
then try to do this code in your terminal
php artisan serve
note:
this will start again the server
I had this problem for several days, it turns out if I created the db inside phpMyAdmin it wouldn't appear to Laravel,
so, I created the db through MySqlWorkbench, and it worked :)
clear your Cache php artisan cache:clear and then restart your server php artisan serve 127.0.0.1:8000
My APP_NAME variables in .env.example and .env and app.php were with space e.g. The App . Surounding that by ' and php artisan cache:clear and setting new generated app key to APP_KEY variable through env files and relaunching the server by php artisan serve solved this issue
In the fourth solution this question was answered but I prefer to answer again to explain this differently .
I make my database in phpmyadmin that is http://localhost/phpmyadmin and the problem was solved .this is my code :
<?php
$servername = "127.0.0.1";
$username = "root";
$password = "";
$dbname = "myDbn2";
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "Database created successfully<br>";
$sql = 'create table if not exists fruits (id integer , name text , color text
, price float) ;';
$conn->exec($sql);
echo 'the table created successfully </br>';
$sql2 = 'insert into fruits values (1 , "apple", "red" , 23.2);';
$conn->exec($sql2);
echo 'insert was successfully';
} catch (PDOException $e) {
echo $e->getMessage();
}
$conn = null;
?>
The code make a database then make a table and insert a record in it .
if you don't make your data base in phpmyadmin site you get the exception
also you don't need to use sql statement CREATE DATABASE name ; and it works without it .
php artisan config:cache
that command fix my 1049 database not found.
Every body have mentioned to php artisan cache:clear. Sometimes it doesn't work.
But in my experience after clearing the cache simply delete the database and create it again.Then run this again
php artisan migrate
Surely it will work.
I got this error because MySQL could not access the database configured in the environment file.
To resolve, I simply created the database that MySQL and the app needs and all works fine.
in my experience I had like this message error ,and i tray all of this solution but nothing to become good ,whay because my fault is i unstall Xampp and i read install again and i forget to create new Database with table that's way in the message say : "Unknown database" it's not exist simply ,now what i do is:
install Xampp (if you have problem in it ofcaurse)
i create now database + table
short you don't see the error message again .
NB ( I'm new in Programation )
< my conseil to be patient when you write your code >
Remove files from this path bootstrap\cache\
Related
I'm making a second connection of my project in laravel with a view in an MsSql database, I configured my .env and config correctly, however this is an error of memory overflow:
$ php artisan tinker
Psy Shell v0.10.5 (PHP 7.3.24-3+ubuntu18.04.1+deb.sury.org+1 — cli) by Justin Hileman
>>> use App\Condinvest\BoletoPropCondominio as BPC
>>> BPC::first();
Illuminate\Database\QueryException with message 'SQLSTATE[HY001] Unable to allocate sufficient memory (meudominio.com.br:5000) (severity 8) (SQL: select top 1 * from [View_Boleto_Prop_Condominio])'
>>>
already changed in my php.ini:
memory_limit = 128M
but the error continues.
My models briefly look like this:
BaseView.php
<?php
namespace App\Condinvest;
use Illuminate\Database\Eloquent\Model;
class BaseView extends Model
{
protected $connection = 'condinvest';
}
BoletoPropCondominio.php
<?php
namespace App\Condinvest;
class BoletoPropCondominio extends BaseView
{
protected $table = 'View_Boleto_Prop_Condominio';
protected $fillable = [
'Id_Condo_lan',
...
'Id_titular'
];
}
when I do the same query directly through the command terminal:
SELECT TOP 1 * FROM View_Boleto_Prop_Condominio;
returns my data successfully.
Can anyone tell me what may be happening, or how I can debug better to understand where the error is, please.
EDIT
>>> DB::connection('condinvest')->getConfig()['driver']
=> "sqlsrv"
Since the error is apparently being reported by the database process (not the php process), I would not expect changes to memory limits in php.ini to have any effect.
I found this issue which mentions this specific error when using a deprecated driver with MSSQL Server.
To check which driver Laravel is using, type DB::connection()->getConfig()['driver'] into your Tinker console. If you see sqlsrv then everything is ok here, but if you see dblib then this might be the source of the error. This problem was supposedly fixed in Laravel 5.7 to prefer the supported drivers if more than one is available, but it's also possible that your database.php config file uses the wrong one.
It is also possible that the memory limits of the database server or the system it resides on are actually being exceeded. Being able to run the query in a command prompt without getting the error suggests that this is not the case, but it may still be worth investigating. If the available memory is very low then it's possible that there is not enough to run both php and the database query at the same time. You can check the available system memory by running the free -h command in the terminal, as long as the database process is running on the same machine as your terminal. However, if you are using a shared hosting provider then it is possible that the database is on a separate machine.
If it helps, i encoutered the same issue. What i did in order to fix it was to check my configuration in database.php, if you use sqlserver, make sure you have charset set to utf8 as follows. It was previously set to utf8mb4.
'sqlserver' => [
'driver' => 'sqlsrv',
'host' => env('DB_SQL_HOST'),
'port' => env('DB_SQL_PORT'),
'database' => env('DB_SQL_DATABASE', 'forge'),
'username' => env('DB_SQL_USERNAME', 'forge'),
'password' => env('DB_SQL_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'options' => [
PDO::ATTR_TIMEOUT => 300
]
]
I am developing an API service that another site I've developed will be using. So locally when building and testing, obviously I want both local copies of the site to work. However, it seems to mix up the environment variables.
For example:
Site A has APP_URL=http://a.local
Site B has APP_URL=http://b.local
I send a GET Request (using Guzzle) from Site A code to http://b.local/test
The /test endpoing in Site B simply dumps out dump(env('APP_URL'))
Result retrieved by Site A is "http://a.local"
Expected result: "http://b.local"
So the code in Site B is running with environment variables loaded from Site A. This is an issue as Site B cannot access the correct database, it's trying to use the Site A's database.
Is this an issue with my local setup (Win10 + WAMP), PHP settings, Laravel settings?
I also encountered this issue, and it is mentioned here. The resolution for it is to run php artisan config:cache in both projects to cache configuration from .env files or patch the code from here.
are you using artisan commands to run both projects with different ports ?
php artisan serve --port=8000
php artisan serve --port=8010
You can set Environment variables in either the vhost config OR in an .htaccess file:
SetEnv APP_URL http://b.local
Apart from #Daniel Protopopov answer above there is also another way, that is also works when both Site A and Site B are Lumen.
In short just rename your DB_DATABASE variable on each side to a different name. Then change the respective variable names in the respective config/<configfilename>.php files.
So that on Site A you would have SITE_A_DB_DATABASE in .env and matching 'database' => env('API_A_DB_DATABASE', 'forge'), line in config/database.php.
Then your Site B SITE_B_DB_DATABASE will not be overwritten due to variable names are different.
The same solution applies for any .env variables which names match.
Because the command php artisan config:cache doesn't work here (closure needed in routes file config file)
LogicException : Your configuration files are not serializable.
I add phpdotenv with composer :
composer require vlucas/phpdotenv
And at the begginning of the file "/bootstrap/app.php" (after "new Illuminate\Foundation\Application"), I add :
$app->detectEnvironment(function () {
$dotenv = Dotenv\Dotenv::create(__DIR__ . '/../', '.env');
$dotenv->overload();
});
Maybe an alternative
If you are calling a Lumen 8 API from within a Laravel 6 application using GuzzleHttp and the Laravel env is being inherited to Lumen, creating config file worked for me.
In bootstrap/app.php comment below lines to prevent loading current env values from Laravel
// (new Laravel\Lumen\Bootstrap\LoadEnvironmentVariables(
// dirname(__DIR__)
// ))->bootstrap();
In bootstrap/app.php add below line after $app has been created.
$app->configure('database');
Create config/database.php in lumen root folder. Return all env values needed for Lumen api in an array in the config file.
<?php
return [
'timezone' => 'UTC',
'default' => 'pdbmysql',
'connections' => [
'pdbmysql' => [
'driver' => 'mysql',
'host' => 'localhost',
'port' => '3306',
'database' => 'db2',
'username' => 'root',
'password' => 'root',
],
],
];
I am developing an API service that another site I've developed will be using. So locally when building and testing, obviously I want both local copies of the site to work. However, it seems to mix up the environment variables.
For example:
Site A has APP_URL=http://a.local
Site B has APP_URL=http://b.local
I send a GET Request (using Guzzle) from Site A code to http://b.local/test
The /test endpoing in Site B simply dumps out dump(env('APP_URL'))
Result retrieved by Site A is "http://a.local"
Expected result: "http://b.local"
So the code in Site B is running with environment variables loaded from Site A. This is an issue as Site B cannot access the correct database, it's trying to use the Site A's database.
Is this an issue with my local setup (Win10 + WAMP), PHP settings, Laravel settings?
I also encountered this issue, and it is mentioned here. The resolution for it is to run php artisan config:cache in both projects to cache configuration from .env files or patch the code from here.
are you using artisan commands to run both projects with different ports ?
php artisan serve --port=8000
php artisan serve --port=8010
You can set Environment variables in either the vhost config OR in an .htaccess file:
SetEnv APP_URL http://b.local
Apart from #Daniel Protopopov answer above there is also another way, that is also works when both Site A and Site B are Lumen.
In short just rename your DB_DATABASE variable on each side to a different name. Then change the respective variable names in the respective config/<configfilename>.php files.
So that on Site A you would have SITE_A_DB_DATABASE in .env and matching 'database' => env('API_A_DB_DATABASE', 'forge'), line in config/database.php.
Then your Site B SITE_B_DB_DATABASE will not be overwritten due to variable names are different.
The same solution applies for any .env variables which names match.
Because the command php artisan config:cache doesn't work here (closure needed in routes file config file)
LogicException : Your configuration files are not serializable.
I add phpdotenv with composer :
composer require vlucas/phpdotenv
And at the begginning of the file "/bootstrap/app.php" (after "new Illuminate\Foundation\Application"), I add :
$app->detectEnvironment(function () {
$dotenv = Dotenv\Dotenv::create(__DIR__ . '/../', '.env');
$dotenv->overload();
});
Maybe an alternative
If you are calling a Lumen 8 API from within a Laravel 6 application using GuzzleHttp and the Laravel env is being inherited to Lumen, creating config file worked for me.
In bootstrap/app.php comment below lines to prevent loading current env values from Laravel
// (new Laravel\Lumen\Bootstrap\LoadEnvironmentVariables(
// dirname(__DIR__)
// ))->bootstrap();
In bootstrap/app.php add below line after $app has been created.
$app->configure('database');
Create config/database.php in lumen root folder. Return all env values needed for Lumen api in an array in the config file.
<?php
return [
'timezone' => 'UTC',
'default' => 'pdbmysql',
'connections' => [
'pdbmysql' => [
'driver' => 'mysql',
'host' => 'localhost',
'port' => '3306',
'database' => 'db2',
'username' => 'root',
'password' => 'root',
],
],
];
I want to access a Mysql data the first step is to create a new table for "vanvlymen" and I typed mysql> USE vanvlymen; the database changed. and type SHOW tables; showing the available of the tables that the database contains.
mysql -u root -p
enter password: ****
mysql> show databases;
-databases-
information_schema
mysql
performance_schema
phpmyadmin
vanvlymen
5 rows...
everything is looking good...
I have decide to tell mysql to specify the database I am working on before executing the query as "vanvlymen"
app/config/database.php
'mysql' => array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'vanvlymen',
'username' => 'foobar',
'password' => 'foobar',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
save as file go to FileZilla using FTP find a file drag and drop into my live server overwrite the database.php file.
I have tried to clear the cache like that
php artisan cache:clear
php artisan migrate
it errors:
SQLSTATE[42000] [1049] unknown database 'forge'.
Why keeping it said unknown database 'forge' I am excepting to change to vanvlymen database. Should I remove mysql and reinstall?
I am using windows 8.1 with laravel 4.2
Using phpmyadmin, I know what is the password and username to log in.
remove two files config.php and services.php in /bootstrap/cache. And try again.
Do you have something like app/config/yourEnvironment/database.php ?
For example local or production. 'forge' is default name of DB in this config file, so it looks like your app is loading wrong config file.
Hopefully this will help someone else. I suddenly had an issue where my dev site I was building stopped connecting to the DB, and just as the OP it was saying:
PDOException SQLSTATE[HY000] [1049] Unknown database 'forge' failed
After much head scratching (!) I found that my hostname value set inside the /bootstrap/start.php was wrong, because my hostname had changed on my macbook pro!? I have no idea how but it changed from something like RobMacbookPro2.local to RobMacbookPro.local. This meant it fell back to production thus loading the incorrect database.php file with the standard DB=forge (which was wrong)
Check this guide:
http://laravel.com/docs/4.2/configuration
Pay particular attention to the code:
<?php
$env = $app->detectEnvironment(array(
'local' => array('your-machine-name'),
));
On a mac and probably linux? you can determine your hostname by typing # hostname in terminal.
Hope that saves someone some time!
If you are running both Xampp and MySQL Workbench, or if You are Running Xampp on the port other than the default port, there may be chances of confusion, you may have created the database using PHPMyAdmin and you are trying to connect it to localhost:cusotmport (e.g. localhost:8080).
what I suggest is to create the database you want using MySQL workbench and then you would get your task done...
There have been several other posts about this, but none of the answers seemed to work for me.
When I navigate to the CakePHP page on my local machine, there is one error:
Cake is NOT able to connect to the database. Database connection
"Mysql" is missing, or could not be created.
When I run this helpful code in my home.ctp, I get the following response:
Error!: SQLSTATE[42000] [1049] Unknown database 'test'
However, my Users/Ben/Sites/myapp/app/Config/database.php looks like this (I set MAMP to look for the document root in Users/Ben/Sites):
<?php
class DATABASE_CONFIG {
public $default = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'Ben',
'password' => 'mypass',
'database' => 'CV',
);
}
I have created a mysql user called Ben with password mypass and created a database called CV under that. Moreover, I can't find mention of a test database anywhere. Help?
Try adding the socket:
'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',
An alternative to unix_socket (especially for OS X people) is to replace localhost with 127.0.0.1
Would be as Follows :
public $default = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => '127.0.0.1',
'login' => 'user',
'password' => 'password',
'database' => 'database-name',
'prefix' => '',
'encoding' => 'utf8',
);
Edit php.ini and add:
extension=php_pdo_mysql.dll
Then restart your web server
On Mac, using MAMP as a development platform, for cake the correct solution is using Domingo Casarrubio solution.
Add the unix_socket parameter to your database configurations.
'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',
This error can also be caused if your connecting database user doesn't have the proper privileges. I believe you only need a minimum of INSERT, SELECT, UPDATE, and DELETE.
Always check username/password and the user privileges first since CakePHP will most likely give a vague database connection error for either.
I noticed that you've had asked this an year ago, and most probably would've solved this by now. However, for those facing the same issues when attempting to install CakePHP on XAMPP, all you have to do is change the 'login' to 'root', i.e. the default login of XAMPP, and leave the 'password' as '', i.e. blank. The complete code in your database.php file should look like this:
public $default = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'root',
'password' => '',
'database' => 'ckblog',//replace with your own database name
'prefix' => '',
//'encoding' => 'utf8',
);
That's it.
I had the same problem and found out eventually that it was caused by CakePhp not accepting that I used a user with a password, even if that user was created in PHPMyAdmin. I had to use the user 'root' with no password.
I found this out after making the following change to the file /lib/Cake/Error/exceptions.php.
The original line:
protected $_messageTemplate = 'Database connection "%s" is missing, or could not be created.';
is changed into this instead (note the change from single to double quotes):
protected $_messageTemplate = "Database connection \"%s\" is missing, or could not be created:\n %s";
This will give you the reason for the problem so that you may change the cause properly.
I have had this problem since upgrading to OSX Yosemite and inserting following line did the trick for me:
'unix_socket' => '/tmp/mysql.sock'
It can be that mysql PDO support is missing.
as root (or using sudo):
apt-get install php5-mysql
Just to help Ubuntu users out:
I had the same error in my ubuntu 13.10 machine with the newest xampp downlaoded directly from apachefriends. Tried most of the stuff in every post I could find about this error, but not the mac-specific stuff.
In the end, the fix happened to be the same as the elected answer here:
Find the socket that mysqld creates for programs to connect to:
user#host /opt$ find . -name mysql.sock
/opt/lampp/var/mysql/mysql.sock
add it to your cakePHP database configuration file (cakePHP)/app/Config/database.php
'unix_socket' => '/opt/lampp/var/mysql/mysql.sock'
To me, this finally resulted in my cake commands being able to be executed without the "Error: Database connection "Mysql" is missing, or could not be created.".
Because, cake bake use unix socket for connecting to database
so that you need add unix_socket for connection string.
You have to confirm location that store mysql.sock in WAS
Example: in my case i'm using xampp on MACOS 10.11
(edit file Config/database.php)
public $default = array(
‘datasource’ => ‘Database/Mysql’,
‘persistent’ => false,
‘host’ => ‘localhost’,
‘login’ => ‘root’,
‘password’ => ‘root’,
‘database’ => ‘cakephp’,
‘encoding’ => ‘utf8’,
‘unix_socket’ => ‘/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock’
);
Finally, It's work for me!
What did it for me in the end was that I had created a table in my database, but there was no data in it.
In order for CakePHP to recognize the MySql connection, there has to be a table with data in it.
You might need to create the table in your php file... Open up phpMyAdmin and check to ensure that they database CV exists.
It's your model. Open that up and there must be the following line
public $useDbConfig = 'local';
This overwrites global config & set it back to local
I tried splicing the code from Example 2 of http://php.net/manual/en/pdo.connections.php into /app/View/Pages/home.ctp. I had to fix the arguments the PDO constructor and change the name of the table in the query. The example 2 code returned the error "Error!: could not find driver". Based on King Jk's answer I was attempting to modify the php.ini when I started to wonder where a php_pdo_mysql.so might live. http://php.net/pdo_mysql showed how it was compiled as part of PHP via the --with-pdo-mysql option to configure. Recompiling fixed my problem. Note I'm working on a Ubuntu 12.10 system with PHP 5.5.9 and Apache Webserver 2.4.6
In my case it was because the database didn't exist. I expected running ./app/Console/cake schema create would create it but it did not. Creating it with create database <database name> in mysql did the trick (although I had already assigned privileges).
I've been struggling with this the whole weekend and finally solved it. Turns out that the php.ini is pointing to a non-existing "extensions dir". Create a phpinfo() file and look at the value of this field:
I noticed that in the mamp php installed folder there is a no-debug-non-zts-20131226 folder, which is different from the value shown in the phpinfo(). What I did was to clone this folder and changed the name to the value of the phpinfo(). Probably you could modify the php.ini file but I didn't want to.
I don't know if you solved your problem, but I'm posting this because my problem was different and google took me here, so I hope to help future googlers having a similiar issue.
Hope this helps.
If you're on Godaddy (or any other shared hosting for that matter), they may be limiting outgoing connections to ports 80 and 443 only.
System configuration:
Fedora 32
php-fpm 7.4.13
mariadb 10.4.17
CAKE 2.10.17
Error message from CAKE:
Database connection "Mysql" is missing, or could not be created.
Enhanced error message using answer at https://stackoverflow.com/a/24722976/5025060
Database connection "Mysql" is missing, or could not be created: Selected driver is not enabled
My problem was no "connector" between PHP and SQL was installed. The solution was:
dnf install php-mysqlnd
This allowed PHP to connect to the database as specified in CAKE's database.php configuration file.