Cake Database Connection Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more cake database connection mysql is missing about Stack Overflow the company Business Learn more about hiring developers or posting ads cake database connection mysql is missing or could not be created with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow
Wp Error Establishing A Database Connection
is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up CakePHP Database connection “Mysql” is missing, or could not be created up
Cakephp Database Connection
vote 23 down vote favorite 2 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 zend framework database connection 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): '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? php mysql osx cakephp mamp share|improve this question edited May 11 '15 at 12:55 hg8 554620 asked Oct 9 '13 at 18:50 Ben Caine 3191211 1 I was getting the same error message and in my case changing permissions for whole Model directory helped a lot. –bbbb Nov 22 '13 at 16:16 add a comment| 17 Answers 17 active oldest votes up vote 39 down vote Try adding the socket: 'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock', share|improve this answer answered Oct 9 '13 at 21:07 Domingo C. 634414 6 Just so you don't wonder where to add this, put is on the last line of your database configuration (for example default) ... I am for example using XAMPP and the file is here: /Applications/XAMPP/xamppfiles/var/mysql/mysql.
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and
Drupal Database Connection
policies of this site About Us Learn more about Stack Overflow the joomla database connection company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users db connection error Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes http://stackoverflow.com/questions/19280245/cakephp-database-connection-mysql-is-missing-or-could-not-be-created a minute: Sign up CakePHP Bake Shell Error: Database connection “Mysql” is missing, or could not be created up vote 7 down vote favorite 1 I have an issue here with baking. I've read the previous answers to similar questions, but the solutions seem to not apply here. I can't bake because the error I receive is: Database connection “Mysql” is missing, http://stackoverflow.com/questions/17952880/cakephp-bake-shell-error-database-connection-mysql-is-missing-or-could-not-b or could not be created If I run which php the PHP it's reading is the correct path within MAMP. If I check the PDO modules: php -i | grep "PDO" PDO PDO support => enabled PDO drivers => sqlite, pgsql, mysql PDO Driver for MySQL => enabled PDO Driver for PostgreSQL => enabled PDO Driver for SQLite 3.x => enabled My application (or what I've completed on it so far) has no trouble connecting to the database. I'm completely stuck. All answers around the web point to PDO not being enabled, or the incorrect path for PHP, but neither of those apply in my case. I'm willing to provide you any information you require to help me repair this. php cakephp pdo command-line-interface cakephp-bake share|improve this question asked Jul 30 '13 at 16:49 Dan Hanly 4,124955114 add a comment| 7 Answers 7 active oldest votes up vote 6 down vote accepted Maybe a wrong username / password or misspelled database name. I once had a database (name) beginning with a space. It took me about 2 hours before I found out.
2.0 Nothing like coming back from a hiatus with a WTF? post. My favorite "cake bake" started failing with the message in the subject; as well it seems that I am not the only http://zenofcoding.com/2012/02/14/error-database-connection-mysql-is-missing-or-could-not-be-created-cakephp-20-cake-bake-trouble/ one who had suffered from the problem… (just give it a quick check on google). After a little research here's a summary of issues and steps to check: The problem is caused the the fact that the PDO drivers are not available when you run php5 in cli mode (i.e. "cake bake"). First thing you'd want to check is which php.ini file is being used by your php (in cli mode!). In database connection your terminal (or command prompt), run: php -ini. This will show the location of the currently used files. In many cases it is possible that your system php is not the same as your web server php, which you might have installed with something like XAMPP. If this is the case you need to change your path to use the correct install of php, which should have the necessary drivers available. Next cake database connection step would be to check your php.ini (which is sometimes broken into a few config files). Check the PDO settings to make sure you have the correct extension enabled (might be as simple as un-commenting a line). For example, I am using MySQL therefore I needed to have MySQL PDO extension available (when running in cli!). It was working perfectly well "on the web". Turns out I needed to run: sudo apt-get install php5-mysql That was unexpected a little since CakePHP had no connection problems to MySQL, but there you go. This should cover all possible cases. If you find other solutions not outlined here, please share. Click to share on Facebook (Opens in new window)Click to share on Twitter (Opens in new window)Click to share on Google+ (Opens in new window)Click to share on Reddit (Opens in new window)Click to share on LinkedIn (Opens in new window)Click to email this to a friend (Opens in new window)Like this:Like Loading... Related David Thanks for this, fixed my problem. I am using a WAMP called Uniserver. After following the trail of other people with this same error message from all over the net I found the problem lies with the MySQL PDO. I checked my php.ini and "extension=php_pdo_mysql.dll" was enabled so I was going crazy