SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question msql login problem HELP PLEASE!

    Hi there
    I have recently installed mysql , apache, and php as per the book
    database driven websites
    i have access to command prompt of mysql and can make and use databases
    however i cannot loginto mysql from the webpage
    php is working fine and so is apache
    i can access the webpages from other computers on my home system ok
    and i can access from the comp that has the servers running on it.
    but cant figure out how to connect to database from the webpage
    chap 4 jokes.php
    the sect below shows one of the configs i have tried I have not found out any reference to $dbcnx so not sure why that is there.
    // Connect to the database server
    $dbcnx = @mysql_connect('localhost', 'dad', 'james');
    if (!$dbcnx) {
    exit('<p>Unable to connect to the ' .
    'database server at this time.</p>');


    any ideas would be appreciated
    regards Ron Kirby
    Last edited by ronkirby; Feb 11, 2005 at 23:37.

  2. #2
    Free your mind Toly's Avatar
    Join Date
    Sep 2001
    Location
    Panama
    Posts
    2,182
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It seems to me that you didn't create a password for the root user.

    If you don't know how to do that, here's a reference:

    Code:
    At the console window type the following commands (replace new_password with your new password):
    Enter: cd c:\mysql\bin
    Enter: mysql −u root mysql
    Response: Welcome to the MySQL monitor .....
    Enter: UPDATE user SET Password=PASSWORD('new_password')
    Enter: WHERE user='root';
    Response: OK...
    Enter: FLUSH PRIVILEGES;
    Response: OK...
    Enter: DELETE FROM user WHERE user='';
    Response: OK...
    Enter: DELETE FROM user WHERE Host='%';
    Response: OK...
    Enter: DELETE FROM user WHERE User='';
    Response: OK...
    Enter: DELETE FROM db WHERE Host='%';
    Response: OK...
    Enter: exit
    Response: Bye
    Enter: exit
    Response: Console window closes.
    Then, if you want to use the root user, you do the following:

    PHP Code:
    $dbcnx = @mysql_connect('localhost''root''your_password'); 
    Community Guidelines | Community FAQ

    "He that is kind is free, though he is a slave;
    he that is evil is a slave, though he be a king." - St. Augustine

  3. #3
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    Quote Originally Posted by Toly
    It seems to me that you didn't create a password for the root user.

    If you don't know how to do that, here's a reference:

    Code:
    At the console window type the following commands (replace new_password with your new password):
    Enter: cd c:\mysql\bin
    Enter: mysql −u root mysql
    Response: Welcome to the MySQL monitor .....
    Enter: UPDATE user SET Password=PASSWORD('new_password')
    Enter: WHERE user='root';
    Response: OK...
    Enter: FLUSH PRIVILEGES;
    Response: OK...
    Enter: DELETE FROM user WHERE user='';
    Response: OK...
    Enter: DELETE FROM user WHERE Host='%';
    Response: OK...
    Enter: DELETE FROM user WHERE User='';
    Response: OK...
    Enter: DELETE FROM db WHERE Host='%';
    Response: OK...
    Enter: exit
    Response: Bye
    Enter: exit
    Response: Console window closes.
    Then, if you want to use the root user, you do the following:

    PHP Code:
    $dbcnx = @mysql_connect('localhost''root''your_password'); 
    Hi toly
    I managed to get it to work yesterday by following instructions from this post http://www.sitepoint.com/forums/show...95&postcount=6
    however after switching the computer off
    i have no access at all
    and the mysql server will not start and won't reconfigure with the windows interface that comes with the program " mysql server config wizard"
    So i will uninstall it and start over
    i will do what you have suggested , I hope it will still work after a reboot.
    Thankyou for your time, it is certainly appreciated.
    regards Ron Kirby
    I will post my results


Bookmarks

Posting Permissions

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