SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Member
    Join Date
    Apr 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    #1045 - Access denied for user 'root'@'localhost' (using password: NO)

    hi!
    I have the error(#1045 - Access denied for user 'root'@'localhost' (using password: NO) )
    I have read solution on other post that is as follow:
    I'm just to confirm you that it's the solution.

    yesterday I tried to fix the problem, but the only think that was missing is the first line in MySQL command:

    UPDATE mysql.user

    I was writing ( UPDATE mysql ) : so please follow the next steps if you want to resolve your problem with ( #1045 - Access denied for user 'root'@'localhost' (using password: NO):

    1 : go to your WAMP icon on your PC desktop screen and LEFT CLICK to open the menu, you will see MYSQL folder, CLICK to see MYSQL CONSOLE, open it.

    2: now you have DOS screen ( a black screen ) :

    A: if you already set a password, type it
    B: if you did not do this step yet, write the following red text
    B1: use mysql; and click ENTER on your keyboard
    3: now write the following red text and click ENTER :

    UPDATE mysql.user
    ->SET Password=PASSWORD("*******")
    ->WHERE User="root";

    don't worry about this sign ( -> ) , because for example when you write ( UPDATE mysql.user ) and you click ENTER on your keyboard, a new line appear with this sign ( -> ), your command will execute when you write this sign ( ; ) at the end of your text and click ENTER.

    NOTE: replace the password ******* by your password.

    4: now write the following red text and click ENTER :

    FLUSH PRIVILEGES;

    5: and to exit the black DOS screen now, write exit and click enter.

    ------------------------- we are finished from MySQL now --------------

    6: go to WAMP folder ( open your My Computer, click on C driver, and you will see WAMP folder ), click on APPS folder, and than click on your PHPMYADMIN folder ( e.g my folder called phpmyadmin2.11.6 ) and find the config.inc.php

    7: open config.inc.php and find the following orange text:

    $cfg['Servers'][$i]['password'] = ''; // MySQL password (only needed

    and add your password now that you used in step number 3 like that :

    [COLOR="rgb(255, 140, 0)"]$cfg['Servers'][$i]['password'] = 'yourpasswordhere'; // MySQL password (only needed[/COLOR]

    8: now save this modification, and close config.inc.php

    9: go to your web browser and type the following link :

    http://localhost/phpmyadmin/

    and enjoy, this is what happened with me.

    NB: I wrote all this explications, because I'm also learning PHP and I found a lot on this website helped me, so I'm trying also to help you.

    But in the Mysql console: i stuck with the following image
    http://imageshack.us/photo/my-images...ysqldaube.jpg/

    I have no idea what password it is asking for can you help me.

    Thanks!!

  2. #2
    SitePoint Member
    Join Date
    Apr 2012
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    What this error message means is that the connection to the database is not correct.

    Somewhere you will have either a config file or a connect file. In this file you have to have your username and password for the database that you are trying to connect to.

    It will look something like this:

    Code:
    $hostname='localhost'; //// specify host, i.e. 'localhost'
    
    $user='SomeUserNameHere'; //// specify username
    $pass='SomePasswordHere'; //// specify password
    $dbase='SomeDatabaseNameHere'; //// specify database name
    Once you find that and update it with the details ($hostname will usually stay as localhost) then all should work!

  3. #3
    SitePoint Member
    Join Date
    Apr 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi..
    Actually my problem is that when i open phpmyadmin from localhost page. i get the above error. i am unable to even to the mysql page, so i am unable to create any sot of database.
    in the config.inc php file i have following code
    $cfg['Servers'][$i]['verbose'] = 'localhost';
    $cfg['Servers'][$i]['host'] = 'localhost';
    $cfg['Servers'][$i]['port'] = '3306';
    $cfg['Servers'][$i]['socket'] = '';
    $cfg['Servers'][$i]['connect_type'] = 'tcp';
    $cfg['Servers'][$i]['extension'] = 'mysqli';
    $cfg['Servers'][$i]['auth_type'] = 'config';
    $cfg['Servers'][$i]['user'] = 'root';
    $cfg['Servers'][$i]['password'] = '';
    $cfg['Servers'][$i]['AllowNoPassword'] = true;

    Here i am not using the password in secondlast line of the code.
    Any sort of help would be appreciated.

  4. #4
    SitePoint Member
    Join Date
    Apr 2012
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is your phpadmin a local install (on your own pc) or on a host (like you log in where your website is located?

  5. #5
    SitePoint Member
    Join Date
    Apr 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    my phpadmin is local install on my pc..

  6. #6
    SitePoint Member
    Join Date
    Jun 2012
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Change the following database config values in your config.default.php:

    $cfg['Servers'][$i]['host'] = 'localhost';
    $cfg['Servers'][$i]['port'] = '3306';
    $cfg['Servers'][$i]['ssl'] = false;
    $cfg['Servers'][$i]['connect_type'] = 'tcp';
    $cfg['Servers'][$i]['extension'] = 'mysqli';
    $cfg['Servers'][$i]['compress'] = false;
    $cfg['Servers'][$i]['user'] = 'root';
    $cfg['Servers'][$i]['password'] = 'YOUR_Password';

    It worked for me. Hope this helps!

  7. #7
    SitePoint Member
    Join Date
    Jul 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay i am also getting this error and that wasn't able to fix it. I've looked in the mysql log and it appears to be a problem with the host:

    120803 7:21:31 InnoDB: 1.1.8 started; log sequence number 1595675
    120803 7:21:31 [Note] Server hostname (bind-address): '(null)'; port: 3306
    120803 7:21:31 [Note] - '(null)' resolves to '::';
    120803 7:21:31 [Note] - '(null)' resolves to '0.0.0.0';
    120803 7:21:31 [Note] Server socket created on IP: '0.0.0.0'.
    120803 7:21:31 [Note] Event Scheduler: Loaded 0 events
    120803 7:21:31 [Note] wampmysqld: ready for connections.
    Version: '5.5.24-log' socket: '' port: 3306 MySQL Community Server (GPL)

    Am i right in thinking that it should say 'localhost' where it says '(null)'? Since it seems to attempt to resolve localhost to an ip anyway, i shall try replacing localhost with 127.0.0.1 in the config file and will post with my results shortly

    Results: Nope, i still get the same thing in the log file which seems odd? I'm stumped! Ill copy and paste my config file just incase anyone can see an error in that that i can't?:

    <?php

    /* Servers configuration */
    $i = 0;

    /* Server: localhost [1] */
    $i++;
    $cfg['Servers'][$i]['verbose'] = '127.0.0.1';
    $cfg['Servers'][$i]

    ['host'] = '127.0.0.1';
    $cfg['Servers'][$i]['port'] = '3306';
    $cfg['Servers'][$i]['socket'] = 'false';
    $cfg['Servers'][$i]['connect_type'] =

    'tcp';
    $cfg['Servers'][$i]['extension'] = 'mysqli';
    $cfg['Servers'][$i]['auth_type'] = 'config';
    $cfg['Servers'][$i]['user'] = 'root';
    $cfg

    ['Servers'][$i]['password'] = '**********';
    $cfg['Servers'][$i]['AllowNoPassword'] = true;

    /* End of servers configuration */

    $cfg

    ['DefaultLang'] = 'en-utf-8';
    $cfg['ServerDefault'] = 1;
    $cfg['UploadDir'] = '';
    $cfg['SaveDir'] = '';


    /* rajk - for blobstreaming */
    $cfg

    ['Servers'][$i]['bs_garbage_threshold'] = 50;
    $cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
    $cfg['Servers'][$i]

    ['bs_temp_blob_timeout'] = 600;
    $cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';


    ?>

    NOTE: There is a password in place of the asterisks, obviously!
    Last edited by adibrad; Aug 2, 2012 at 23:32. Reason: Additional Details

  8. #8
    SitePoint Member
    Join Date
    Aug 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by coderfromktl View Post
    Change the following database config values in your config.default.php:

    $cfg['Servers'][$i]['host'] = 'localhost';
    $cfg['Servers'][$i]['port'] = '3306';
    $cfg['Servers'][$i]['ssl'] = false;
    $cfg['Servers'][$i]['connect_type'] = 'tcp';
    $cfg['Servers'][$i]['extension'] = 'mysqli';
    $cfg['Servers'][$i]['compress'] = false;
    $cfg['Servers'][$i]['user'] = 'root';
    $cfg['Servers'][$i]['password'] = 'YOUR_Password';

    It worked for me. Hope this helps!
    I had to change this line
    $cfg['Servers'][$i]['extension'] = 'mysqli';

    to this
    $cfg['Servers'][$i]['extension'] = 'mysql';
    and that worked for me
    I also installed with no password as I saw a couple other posts reference problems related to doing that.

  9. #9
    SitePoint Member
    Join Date
    Jul 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Really? I've been scouring through files i dont fully understand for hours and its the letter i that doomed me! Thanks so much for your help

  10. #10
    SitePoint Member
    Join Date
    Aug 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i was in the same boat. I think you may come across a second error associated with this change. Can't remember what it was now. But you will know where to look

  11. #11
    SitePoint Member
    Join Date
    Jan 2013
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $cfg['Servers'][$i]['password'] = 'yourpassword';
    $cfg['Servers'][$i]['AllowNoPassword'] = true;


Tags for this Thread

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
  •