www.webdeveloper.com
Results 1 to 7 of 7

Thread: phpmyadmin connect to mysql probs.

  1. #1
    Join Date
    Aug 2012
    Location
    Brighton UK
    Posts
    8

    phpmyadmin connect to mysql probs.

    Hi. I've installed wamp on windows 7 successfully and opened mysql console. i changed the password and created a database. each time i open the console and give my password it is fine. I then went to phpmyadmin in the wamp and it comes up with error saying cannot connect to mysql using localhost, root, password (NO). How is it that I can connect using a php script function:
    $link = mysqli_connect('localhost', 'root', 'myPassword'); //(myPassword is not the password obviously
    if ($link)
    {
    $output = 'connected to the database server.';
    include 'output.html.php';
    exit();
    does phpmyadmin have a config where I have to put in my password?
    i'm very confused
    thanks for looking and thanks for an answer

  2. #2
    Join Date
    May 2012
    Location
    St. Helens, UK
    Posts
    74
    Hi! I've not used PHPMyAdmin for some time, but I've got a feeling that it may not allow root login from the web interface as a security feature; try creating a non-root user, giving it appropriate privileges on the database, and then see if you can log into PHPMyAdmin using your new non-root user.

    Syntax would be something along the lines of:

    Code:
    CREATE USER 'lenny'@'localhost' IDENTIFIED BY 'password1';
    GRANT ALL ON mydatabase.* TO 'lenny'@'localhost';

  3. #3
    Join Date
    Aug 2012
    Location
    Brighton UK
    Posts
    8
    Quote Originally Posted by daihuws View Post
    Hi! I've not used PHPMyAdmin for some time, but I've got a feeling that it may not allow root login from the web interface as a security feature; try creating a non-root user, giving it appropriate privileges on the database, and then see if you can log into PHPMyAdmin using your new non-root user.

    Syntax would be something along the lines of:

    Code:
    CREATE USER 'lenny'@'localhost' IDENTIFIED BY 'password1';
    GRANT ALL ON mydatabase.* TO 'lenny'@'localhost';
    hi daihuws, i take it that i should use a different password than the root password ie; indentified by 'whateverpassword'
    I edited the config.inc.php to password='mypassword' which merely changes error to using password YES. i also changed the port to 3306. server is localhost user=root. if i create user lenny i suppose i should change that in the config.inc.php file also?
    Last edited by LennyOneStep; 08-25-2012 at 08:50 AM. Reason: clarification

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,251
    I don't have access to a PHPMyAdmin config file at the moment, but I have always set the 'auth_type' config setting to 'cookie', which will then display a login screen whenever you start a new PHPMyAdmin session, allowing you to log in with whichever defined MySQL user you want to use (including root).
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  5. #5
    Join Date
    Aug 2012
    Location
    Brighton UK
    Posts
    8
    Hi NogDog
    I have solved the problem! only took six hours!
    I had to reset password in the mysql console
    big sigh of relief! i will post solution shortly.
    thanks for help and interest

  6. #6
    Join Date
    May 2012
    Location
    St. Helens, UK
    Posts
    74

    Smile

    Glad to hear that you got it sorted.

  7. #7
    Join Date
    Aug 2012
    Location
    Brighton UK
    Posts
    8
    Thank you. Here is my solution garnered from hours of searching.

    For any other fellow newbies here is the whole fix:-
    mysql>UPDATE mysql.user
    ->SET Password=PASSWORD("*******")
    ->WHERE User="root";
    mysql>FLUSH PRIVILEGES;

    This is from Sitepoint's "Build your own Database Driven Website using PHP and MYSQL"

    And then as Longneck said specify the password in the config.inc.php file for phpmyadmin.

    Kind regards,

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles