SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2000
    Location
    Location:
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello all! I'm Koncise.

    I'm reletively a beginner regarding web development and I need a little help regarding passwords!

    First I need to know whether it is absolutley neccessary to enter a password before I start using mysql. I followed Kevin's guide and indeed I did enter in a password using the command: mysqladmin -u root password "password".

    If I do NOT enter a password can I still still connect to the mysql server using php scripts?? The reason I ask is because all of Kevin's connection examples (the jokes database connection) all assume that a password is being used.

    Another (related) question is that regarding access to the phpmyadmin page (via http://localhost/phpMyAdmin/index.php). It seems I can can connect to the page normally typing in the above url, however when I enter a password to mysql (using the mysqladmin -u root password "my password" command) I'm denied access to the page, instead I get the message:

    "Warning: MySQL Connection Failed: Access denied for user: 'root@localhost' (Using password: NO) in lib.inc.php on line 255
    Error "

    It is clear that the entering the password has caused the problem, but I don't understand why?

    Any help would be greatly appreciated,

    (I'm currently using an Apache/php/Mysql bundle avaliable from http://www.firepages.com.au/php.php3 - so hopefully those using the same bundle can relate to my problem also!)

    thanx very much!


    Koncise

  2. #2
    SitePoint Wizard
    Join Date
    Apr 2000
    Posts
    1,483
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If a password has been set for the username in MySQL, then it must be used in scripts that connect to it.

    From your error it seems like there is no password being entered ("using password: NO")

    The command should be this:
    mysql_connect("localhost", "root", "password");
    mysql_select_db("databasename");
    Last edited by James; Feb 7, 2001 at 11:48.

  3. #3
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    So to answer your questions specifically,

    First I need to know whether it is absolutley neccessary to enter a password before I start using mysql.
    No, it isn't. To make a MySQL database connection without a password, just omit the corresponding argument in your mysql_connect() call:

    PHP Code:
    <? mysql_connect("localhost""root"); ?>
    Note that it is highly advised that you do set up a password. Otherwise, your database is open for the world to see (and change!). At the very least, you should restrict password-less MySQL users so that they can only connect from the local machine, or have restricted access (e.g. read-only).

    Another question is regarding access to the phpmyadmin page. It seems I can can connect to the page normally, however when I enter a password to mysql (using the mysqladmin -u root password "my password" command) I'm denied access to the page, instead I get the message.
    You need to configure your installation of phpMyAdmin to connect using the password you have set. Instructions for doing this should be found in the installation instructions accompanying phpMyAdmin, but if you do get stuck let us know and we'll dig up the neccessary information.
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference

  4. #4
    SitePoint Enthusiast
    Join Date
    Oct 2000
    Location
    Location:
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanx very much!

    I'll try to edit the installation of phpdev and report back.

    Koncise.


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
  •