i follow one of the eg from internet, state that if i connect to local MySQL server, will obtained the following after running the PHP script:
5.0.2-alpha
localhost via TCP/IP

the script is as follows:
<?php
$con = mysql_connect('localhost');
print(mysql_get_server_info($con)."\n");
print(mysql_get_host_info($con)."\n");
mysql_close($con);
?>

i using notepad to key in and save the above script in document_root path "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs" as test3.php and then from my internet browser, i key in http://localhost/test3.php, but it shows internal server error and can't open the page and can't show the expected outcomes.

Is it my way to run the script wrong?

And how i know that i am connect to local MySQL server?

    <?php
    
    /// For the following details,
    /// please contact your server vendor :)
    
    $hostname='***'; //// specify host, i.e. 'localhost'
    $user='****'; //// specify username
    $pass='****'; //// specify password
    $dbase='****'; //// specify database name
    $connection = mysql_connect($hostname , $user , $pass)
    or die ("Can't connect to MySQL".mysql_error());
    $db = mysql_select_db($dbase , $connection) or die ("Can't select database.".mysql_error());
    ?>

    And a hello world is working ?

      Hello World program is working fine, but when i test with database, it gots error.

      I have try the above code, but i don't know how to set the host name, user name and password.

      In the MySQL command line client, it will appear:
      Enter password:
      after enter the password there is server version:5.1.30-community MySQL Community Server

      Is it the information i need to key in hostname, user and password?

      If not, how i going 2 check without refering to the vendor?

        did you have phpmyadmin installed? If yes, go to the Privileges config,

        and see the default mysql username and password (in a default is usually username: root Pass is empty.

        And localhost is the host ( but not in all cases)

        Hello, jjozsi.

          I hv download the phpmyadmin, phpMyAdmin-3.1.2-english.zip but there is no setup icon to run, so it does not need to run any installation?

          Therefore i search through all the folder and file but can't find Privileges config, can u give me more specified details?

          I try to reinstall mysql, i run the following steps:
          Run the MSI file and use the following settings
          Typical Setup
          make sure "Configure the MySQL Server now" is checked
          "Detailed Configuration"
          "Developer Machine"
          "Multifunctional Database"
          "InnoDB Tablespace Settings" - leave everything default
          "Decision Support (DSS)/OLAP"
          make sure "Enable TCP/IP Networking" is checked and leave the port number at 3306 (at this point, if you have a firewall, it will usually try to access itself on the localhost)
          "Standard Character Set"
          check "Install As Windows Service"
          enter your root password and I would recommend leaving "Enable root access from remote machines" unchecked
          then hit "execute" and it'll install and set it up.

          but i not sure what is the root password it mentions?

            i think this install guide is good, but,

            you can have apache distibution such as: appserv, WAMP , phptriad, Easyphp

            where then mysql and apache server installed like a NEXT-NEXT style install 🙂
            For a local server its quite good.
            And phpmyadmin is in these packages, so you don't need to install.
            Phpmyadmin is a web based tool to manage your database.

            root password for mysql that you can set from command line (its in the guide).

            Hello,
            jjozsi.

              Thank for your reply.

              The guide that you say is good is referred to the link for non-install version or the MSI version?

              Is for the link, i hv try install manually, with MySQL itself it running well, but when came to connect with php, i have this error:[Thu Feb 12 09:01:19 2009] [error] [client 127.0.0.1] PHP Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\testing.php on line 12.

              if i install WAMP, do i nid 2 unstall my already installed php5, apache 2.2 and mysql 5.1 or it will actually overwrite itself when i install WAMP? By the way, which package is better, i mean for the appserv, WAMP , phptriad, Easyphp?

              root password for mysql that you say i can set from command line is from which guide you mean?

                4 days later

                After i installed the Apache2triad, i can straight away use the PHP and MySQL without any editing? So, now i need to know how to use phpmyadmin to create database, right? Then, i can run the previous php-mysql connection script... Is it like that?

                  Thanks, djjjozsi!!!

                  I finally get the connection between php and mysql..........

                    Write a Reply...