38175425 Posted September 17, 2021 Share Posted September 17, 2021 Why "Database connection failed"? In the third picture, you can see "todolist_demo" Quote Link to comment https://forums.phpfreaks.com/topic/313758-why-database-connection-failed%C2%A0/ Share on other sites More sharing options...
requinix Posted September 17, 2021 Share Posted September 17, 2021 Is MySQL running? On port 8889? Is the username and password correct? Does the database exist? Does the user have permission to access it? Did you look at the exception in $e to see if that might have useful information? Quote Link to comment https://forums.phpfreaks.com/topic/313758-why-database-connection-failed%C2%A0/#findComment-1590005 Share on other sites More sharing options...
38175425 Posted September 17, 2021 Author Share Posted September 17, 2021 29 minutes ago, requinix said: Is MySQL running? On port 8889? Is the username and password correct? Does the database exist? Does the user have permission to access it? Did you look at the exception in $e to see if that might have useful information? 1. Yes. MySQL is running on port 8889. 2. Where do I check if the username and password are correct? 3. Yes. The database does exist. 4. How do I check if the user have permission to it? Quote Link to comment https://forums.phpfreaks.com/topic/313758-why-database-connection-failed%C2%A0/#findComment-1590008 Share on other sites More sharing options...
requinix Posted September 17, 2021 Share Posted September 17, 2021 9 minutes ago, 38175425 said: 2. Where do I check if the username and password are correct? Either you or MAMP would have set up that user and its password. I think that information is available somewhere in phpMyAdmin. 9 minutes ago, 38175425 said: 4. How do I check if the user have permission to it? Try logging into phpMyAdmin with those credentials and seeing what happens. Quote Link to comment https://forums.phpfreaks.com/topic/313758-why-database-connection-failed%C2%A0/#findComment-1590010 Share on other sites More sharing options...
38175425 Posted September 17, 2021 Author Share Posted September 17, 2021 18 minutes ago, requinix said: Either you or MAMP would have set up that user and its password. I think that information is available somewhere in phpMyAdmin. Try logging into phpMyAdmin with those credentials and seeing what happens. Yes. The username and the password are correct. Quote Link to comment https://forums.phpfreaks.com/topic/313758-why-database-connection-failed%C2%A0/#findComment-1590013 Share on other sites More sharing options...
38175425 Posted September 17, 2021 Author Share Posted September 17, 2021 22 minutes ago, requinix said: Try logging into phpMyAdmin with those credentials and seeing what happens. What does it mean? How do I do it? I'm sorry I'm only a beginner Quote Link to comment https://forums.phpfreaks.com/topic/313758-why-database-connection-failed%C2%A0/#findComment-1590014 Share on other sites More sharing options...
gw1500se Posted September 17, 2021 Share Posted September 17, 2021 Search engines are your friend. PHPMyAdmin Quote Link to comment https://forums.phpfreaks.com/topic/313758-why-database-connection-failed%C2%A0/#findComment-1590015 Share on other sites More sharing options...
38175425 Posted September 17, 2021 Author Share Posted September 17, 2021 My problem is solved thank you so much Quote Link to comment https://forums.phpfreaks.com/topic/313758-why-database-connection-failed%C2%A0/#findComment-1590031 Share on other sites More sharing options...
ginerjm Posted September 17, 2021 Share Posted September 17, 2021 (edited) For the benefit of others who may come here with the same problem - how about telling us what your solution was? Edited September 17, 2021 by ginerjm Quote Link to comment https://forums.phpfreaks.com/topic/313758-why-database-connection-failed%C2%A0/#findComment-1590032 Share on other sites More sharing options...
38175425 Posted September 20, 2021 Author Share Posted September 20, 2021 On 9/18/2021 at 12:36 AM, ginerjm said: For the benefit of others who may come here with the same problem - how about telling us what your solution was? I found the problem: the password and the username were incorrect. I went to MAMP>bin>phpMyAdmin>config.inc and I found the correct password and the correct username Quote Link to comment https://forums.phpfreaks.com/topic/313758-why-database-connection-failed%C2%A0/#findComment-1590169 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.