Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    my sql connection prob

    I am using dreamweaver









    installation help

    « on: Today at 10:10:08 AM »

    Quote
    Modify


    all i am doing is producing a database on my local machine

    i have named my database in phpmyadmin

    and linked (created) a user for it in the privaleges section also highlighting a password for the user

    then i have a connect_to_mysql.php script

    <?php

    /*
    1: "die()" will exit the script and show an error statement if something goes wrong with the "connect" or "select" functions.
    2: A "mysql_connect()" error usually means your username/password are wrong
    3: A "mysql_select_db()" error usually means the database does not exist.
    */
    // Place db host name. Sometimes "localhost" but
    // sometimes looks like this: >> ???mysql??.someserver.net
    $db_host = "localhost";
    // Place the username for the MySQL database here
    $db_username = "talos342c";
    // Place the password for the MySQL database here
    $db_pass = "dollybrom1";
    // Place the name for the MySQL database here
    $db_name = "mydbstore";

    // Run the actual connection here
    mysql_connect("$db_host","$db_username","$db_pass") or die ("could not connect to mysql");
    mysql_select_db("$db_name") or die ("no database");
    ?>

    then i have a mysql_quicktest.php

    please help!


    <?php
    // Connect to the file above here
    require "connect_to_mysql.php";

    echo "<h1>Success in database connection! Happy Coding!</h1>";
    // if no success the script would have died before this success message
    ?>


    and they are saved in a file called storescripts both of the above files

    so i then proceed to try to seeif i can get a connection

    http//localhost/myNewweb/storescripts/mysql_quicktest.php

    ! ) Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'talos342c'@'localhost' (using password: YES) in C:\wamp\www\myNewweb\storescripts\connect_to_mysql.php on line 19
    Call Stack
    # Time Memory Function Location
    1 0.0021 666856 {main}( ) ..\mysql_quicktest.php:0
    2 0.0037 672280 require( 'C:\wamp\www\myNewweb\storescripts\connect_to_mysql.php' ) ..\mysql_quicktest.php:3
    3 0.0038 673248 mysql_connect ( ) ..\connect_to_mysql.php:19
    could not connect to mysql


    what i think is happening is that access is being denied due to the password well i have typed the password in time after time into phpmyadmin in the privaleges section, but something is wrong ..


    I have had this working but reformatted my pc then went back and did it again and it does not work now, it is almost as if mysql remebers and how many mysql db can you run for free, do not know the inns and outs

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,155
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    Do this: Bring up a command window (DOS window). Then try the command line version of mysql, thus:
    Code:
    mysql -utalos342c -pdollybrom1 -Dmydbstore
    See if that allows you to get into the DB.

    If yes, the problem is in PHP.

    If no, the problem is in the credentials.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •