Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5993025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:36:57+00:00 2026-05-22T23:36:57+00:00

I created a database with MySQL Workbench, and now I need to access it.

  • 0

I created a database with MySQL Workbench, and now I need to access it. So I’ve written a php script to access it:

<? 
    $db = mysql_connect("127.0.0.1:3306","root", "");

    if (!$db){
        echo "Could not connect to database";
        exit();
    }

    $db_name = "pfc_db";
    if (!mysql_select_db($db_name, $db)){
        die ("Could not select database");
    }

    $sql=mysql_query("select * from CAPAS");
    while($row=mysql_fetch_assoc($sql)){
        $output[]=$row;
        if (isset($output)){
            echo "yes";
            echo $output[0];
        }
        else{echo "no";}
    }
    mysql_close();

?>

I have doubts about MAMP and MySQL Community Server and I need a push on the right path.
I’ve installed MAMP on my mac and switched the ports to the default mysql ones 3306. I’ve placed the PHP test script in a folder “Api” I’ve created under htdocs. So to try it out i type on my browser http://127.0.0.1/api/test.php and the result is “Could not connect to databse”. Am I doing it right?

And what about Community Server? Is it better than MAMP? Should it be running for MAMP to work? Can I just use Community Server? If so, where should I place the PHP scripts? Which folder? Because when I try to do the same test with Community Server, instead of showing the error message, the browser starts downloading the php script to my downloads folder. Why happens that?

As you can see I have a bit of a mess in my mind with these server stuff and I need some help to figure it out.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:36:58+00:00Added an answer on May 22, 2026 at 11:36 pm

    Well, I’m gonna answer myself so that if someone runs into the same problem.

    The error of password happened because I had two installations of mysql in the same computer, so that I was checking the passwords in one of them and the browser was looking at the other.

    Therefore, if you have problems with password access, check that you don’t have two mysql installed and also check the file config.inc.php

    I also changed TCP/IP by a socket connexion, which improves the speed if you’re using your localhost as server.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a MySQL database using MySQL Workbench. It has about 20 tables.
I am trying to import an access database to mysql. I have created a
I used MySQL Workbench to generate a database and now I inserted it into
I have created a MySQL database wherein users add information via PHP. Each time
I was just looking at the MySql database created by drupal after I installed
I created a new mysql database and i want to use foreign keys with
I have a backup created of my mysql database (vbulletin forum v3.8) everyday. It's
I've created a form that stores free text fields into a MySQL database. All
I am trying to reconstruct a database query I created for MySQL in Microsoft
Is it possible to extract a script from an MySQL database to create a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.