just now i installed new cakephp 5.1.2 create migrations. I setup all mysql database event in cakephp 5x, but when i hit the migration command it throw error… please help whats wrong with here. if you guys release new cakephp version than first update the DOCUMENTS first than relase new the version.
as the error states you are not able to connect to your mysql server.
This has nothing to do with updating docs or releasing new versions because nothing here has changed. Check your config/app_local.php Datasources section AND make sure when you open the CakePHP app for the first time (via e.g. bin/cake server) in your browser, that this is green.
Ok so now i open it cakephp built in server, http://localhost:8765 now it show red indicator, no database connection… event it is a error!
so what is the problem? if open it direct in url without port than it show database connection successfully with green button. So Is It a Bug?
If you don’t get the same page with the CakePHP built in server (which is just a plain old php -S localhost:8765) and your Apache Webserver it indicates to me, that you didn’t set the docroot properly in your apache webserver.
By “properly” I mean to a different CakePHP app, which works.
also be aware, that 'host' => 'localhost', means, that PHP tries to connect via a UNIX Socket.
Which UNIX is used can be found inside your PHP settings (or via a PHPInfo page)
If your MySQL server only allows IP connections then you probably need to adjust that to 'host' => '127.0.0.1',