me looking so small in this world

15 2006f September, 2006

enabling phpMyAdmin once you change root password or permission or privileges on mysql database

Filed under: xampp — rudyegenias @ 7:36 am

This applies to xampp-1.5.3a:
(don’t know about other versions since I only have this one. It works also for xampplite)

Yes, after a fresh install of a xampp program you are welcomed with a xampp pseudo website which is located in <path of xampp installation>/htdocs/xampp/. Clicking security you are given some important points to secure your website. That includes changing the root password. But alas, after changing it you’ll not be given a chance to use the ever-friendly phpMyAdmin.

Find <path of xampp installation>/htdocs/xampp/phpmyadmin/config.inc.php

$cfg['Servers'][$i]['password'] = ”; // MySQL password

Change this so that it’ll reflect your current mysql password.

$cfg['Servers'][$i]['password'] = ‘your_password_here‘; // MySQL password

Don’t forget to save it aight?!

And if you read furthermore you can see that you can also restrict/assign a mysql user with just enough privilege to access the database. :)

56 Comments »

  1. [...] config- it will use the password and username from the configuration file. Remember the last tutorial? (read it here) [...]

    Pingback by restrict access to phpMyAdmin by authentication « me looking so small in this world — 16 2006f September, 2006 @ 1:39 am | Reply

  2. can anyone tell me how i can reset root password?
    someone accidentaly change the password withing phpmyadmin and of course that did not match with mysql password which is empty by default on root….

    i tried this http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html but it kinda hangs…

    a step by step would be helpful…PLEASE HELP!!!!!!!!!

    Comment by CHARLES — 10 2006f November, 2006 @ 9:41 pm | Reply

  3. find the config.inc.php with the installation of your phpmyadmin and set the $cfg[’Servers’][$i][’password’] = ‘your_password_here‘; your_password_here to blank if your root password is still blank.

    if this didn’t work please describe your problem in detail.

    you can change the root password in phpmyadmin by visiting the url of your phpmyadmin installation and clicking privileges.. after that find the user root and click the edit icon to the part of that line.. then you can change the password and privileges with the root..

    English is not my native tounge so if you still have questions please do reply again.

    Hope that helps.

    Comment by rudyegenias — 11 2006f November, 2006 @ 8:22 am | Reply

  4. this is my problem:
    my college tried to secure databases in phpmyadmin by putting a password via phpmyadmin. the root was blank.
    even if we still know the password, when i try to login with that password i get this error:
    #1045 – Access denied for user ‘pma’@'localhost’ (using password: NO)
    i went to config-inc.php to try to redifine the password but no success.

    so i don’t know how to access my databases anymore.
    is there anyway to restore that password or is there a workaround for this so that i don’t lose my data.
    PS: i can still open my pages and produce my reports ….so that database are still accessible with my php codes but i can SEE the databases!!

    hope you understand now…otherwise let me know…HEEEELP!

    Comment by CHARLES — 11 2006f November, 2006 @ 5:31 pm | Reply

  5. Hey i got an answer…
    i put the same password in $cfg['Servers'][$i]['controlpass'] and it worked….
    apparently the password that was changed was ‘pma’ password… by default it’s empty in config.inc.php……..remember i am new in php and mysql stuff,,,,

    thanks for trying to help

    Comment by CHARLES — 13 2006f November, 2006 @ 3:05 am | Reply

  6. There you go.. some searching and creativity would bring forth success.. thanks again for commenting..

    Comment by rudyegenias — 13 2006f November, 2006 @ 8:14 am | Reply

  7. I am using xampp for linux 1.5.5a.

    Do you have any ideas why in phpMyAdmin I cannot create any new databases?

    Create new database:
    No Privileges

    Thanks

    Comment by slush1000 — 4 2006f December, 2006 @ 6:37 am | Reply

  8. do you own the database/os that it is running on? or is it on hosting?

    have installed it on linux with no problems at all

    have you changed root password for mysql?
    if so check this /opt/lampp/phpmyadmin/config.inc.php

    Comment by rudyegenias — 8 2006f December, 2006 @ 2:15 pm | Reply

  9. Hi Rudy

    I am kind of new to Linux and Lampp. I installed puppy linux and lampp. I haven’t created any new users, but changed all the passwords. When i go to phpMyAdmin, I dont see any previleges to create database. I am trying to install mambo and mambo couldn’t create the database using the default username, pma. Any ideas? PS: I did changed the root password for mysql going to the file, config.inc.php

    Thanking you
    Jerry

    Comment by Jerry — 25 2007f March, 2007 @ 9:20 pm | Reply

  10. Thanks Jerry for visiting.

    Try setting

    $cfg['Servers'][$i]['auth_type'] = ”;

    to

    $cfg['Servers'][$i]['auth_type'] = ‘cookie’;

    It will then ask for your username and password and enter the necessary credentials.

    Hit back again if this didn’t solve the problem.

    Comment by rudyegenias — 27 2007f March, 2007 @ 11:11 am | Reply

  11. Thankyou rudy for your reply. I resolved it creating a new mysql user name and password using the GRANT command, giving full previleges.

    Comment by Jerry — 31 2007f March, 2007 @ 12:10 pm | Reply

  12. how to change root password in phpmyadmin with mysql server.
    when i changed the password then phpmyadmin shows an error :
    #1045-Access denied for user: ‘root@localhost’ (Using password: Yes)

    please reply the solution

    Comment by sumit joshi — 13 2007f April, 2007 @ 9:38 pm | Reply

  13. into the sql tab on phpmyadmin or in console:

    UPDATE user SET Password=PASSWORD(’newrootpassword’) WHERE User=’root’;FLUSH PRIVILEDGES;

    Comment by rudyegenias — 15 2007f April, 2007 @ 10:39 am | Reply

  14. great job man, it worked

    Comment by tantrik — 21 2007f April, 2007 @ 7:36 am | Reply

  15. Plz help me .. i was deleting pma account from xampp(phpmyadmin pannel) ,when i enter to d phpmyadmin showed me error is :

    #1045 – Access denied for user ‘pma’@'localhost’ (using password: NO)
    Otherway how can i creating database without phpmyadmin in xampp ?

    i am begineer.

    Comment by zawkosan — 1 2007f May, 2007 @ 2:47 am | Reply

  16. You can still use the command prompt to create databases.

    More information for this here: http://dev.mysql.com/doc/refman/5.1/en/database-use.html

    Basically there are 3 database instances which holds data for PHPMyAdmin which did you deleted?

    Can you still log in mysql? If so go to your installation directory(I am assuming you are using windows in command line.

    Issue this command:

    mysql -uroot -p

    Paste this:

    /*Data for the table `user` */

    insert into `user`(`Host`,`User`,`Password`,`Select_priv`,`Insert_priv`,`Update_priv`,`Delete_priv`,`Create_priv`,`Drop_priv`,`Reload_priv`,`Shutdown_priv`,`Process_priv`,`File_priv`,`Grant_priv`,`References_priv`,`Index_priv`,`Alter_priv`,`Show_db_priv`,`Super_priv`,`Create_tmp_table_priv`,`Lock_tables_priv`,`Execute_priv`,`Repl_slave_priv`,`Repl_client_priv`,`Create_view_priv`,`Show_view_priv`,`Create_routine_priv`,`Alter_routine_priv`,`Create_user_priv`,`ssl_type`,`ssl_cipher`,`x509_issuer`,`x509_subject`,`max_questions`,`max_updates`,`max_connections`,`max_user_connections`) values (‘localhost’,'pma’,”,’N',’N',’N',’N',’N',’N',’N',’Y',’N',’N',’N',’N',’N',’N',’N',’N',’N',’N',’N',’N',’N',’N',’N',’N',’N',’N',”,”,”,”,0,0,0,0),(‘localhost’,'root’,”,’Y',’Y',’Y',’Y',’Y',’Y',’Y',’Y',’Y',’Y',’Y',’Y',’Y',’Y',’Y',’Y',’Y',’Y',’Y',’Y',’Y',’Y',’Y',’Y',’Y',’Y',”,”,”,”,0,0,0,0);

    flush priviledges;

    Hope that helps. It’ll also reset your root password to blank.

    Comment by rudyegenias — 2 2007f May, 2007 @ 8:58 am | Reply

  17. Thanks you, now i got it ,
    (’localhost’,’pma’,”,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’Y’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,”,”,”,”,0,0,0,0)

    Comment by zawkosan — 2 2007f May, 2007 @ 5:31 pm | Reply

  18. zawkosan, glad to be of help.

    Comment by Rudy Egenias — 3 2007f May, 2007 @ 8:55 am | Reply

  19. how to change in root password.my reason for come back i will missed and i dontknow my computer root password in linux.,so how to change in my computer linux root password.please give your solution.i dont know english well .please uinderstand.ok thank you.iam waiting for ur answer

    Comment by yuvaraj — 17 2007f May, 2007 @ 2:10 pm | Reply

  20. root password how to change i dont know.i k dont know linux root password in my computer

    Comment by yuvaraj — 17 2007f May, 2007 @ 2:13 pm | Reply

  21. Guide to resetting root password on linux box.
    http://linuxgazette.net/107/tomar.html

    Hope that helps.

    Comment by rudyegenias — 17 2007f May, 2007 @ 2:19 pm | Reply

  22. What is the default password for lampp

    Comment by Henry — 5 2007f July, 2007 @ 1:25 am | Reply

  23. Henry X/LAMPP in default has no password instead for security you should run this command (as root) to set all of it:

    /opt/lampp/lampp security

    Cheers.

    Comment by rudyegenias — 5 2007f July, 2007 @ 5:40 pm | Reply

  24. Hey I’m new to php myadmin and I just got the bad luck of the draw but luckily in these past couple days I have gotten down to the last step and it just so happens I don’t feal like changing my root password to nothing and even using root for phpmyadmin… So I created a new user on mysql called ‘pma’@'localhost’ with password ‘w/epassis’, but how do I configure phpmyadmin to use that connection?

    Comment by robert — 22 2007f August, 2007 @ 5:04 pm | Reply

  25. ” phpMyAdmin can manage a whole MySQL server (needs a super-user) as well as a single database. ” – http://phpmyadmin.sourceforge.net/documentation/

    What I would be suggesting is you to try create another super-user (is that even possible?!) and use that account. And possibly use these values here in config.inc.php(haven’t tried this and i won’t take law suits for this ):

    $cfg['Servers'][$i]['user'] = ‘another-supr-root’;
    $cfg['Servers'][$i]['password'] = ‘your-strongest-passw0rd-ever’;

    Comment by rudyegenias — 23 2007f August, 2007 @ 12:41 am | Reply

  26. Yeah I already have the ’super-user’ created but those variables don’t change anything. =\

    Comment by robert — 23 2007f August, 2007 @ 6:05 am | Reply

  27. I had the same issue after changing the root password…did as said here….

    $cfg[’Servers’][$i][’password’] = ‘your_password_here‘; // MySQL password

    and saved. Bingo! now my PhpMyAdmin is working!!!!!! thanks a lot, Rudy.

    Comment by Rajesh — 16 2007f September, 2007 @ 1:40 am | Reply

  28. I am glad that I have helped rajesh.. thanks for visiting. Cheers.

    Comment by rudyegenias — 17 2007f September, 2007 @ 9:00 pm | Reply

  29. Hey guys, i have a problem. I’m using XAMPP, with phpmyadmin version 2.8.1. I change the root password and suddenly i can’t access the phpmyadmin!

    I tried doing the “$cfg[’Servers’][$i][’password’] = ‘your_password_here‘; // MySQL password” instruction posted here but to no avail.

    Pls. help me as soon as possible i need to access my database. What shall i do?

    Thanks in advance!

    Comment by ariseo — 27 2007f September, 2007 @ 11:28 am | Reply

  30. What happens when you access:

    http://localhost/phpmyadmin/

    Anyway you have to restart mysql for the new password to take effect.

    You probably need to set your: $cfg['Servers'][$i]['auth_type'] to

    $cfg['Servers'][$i]['auth_type'] = ‘config’;

    instead of `cookie’ or `http’

    Hope that helps.

    Comment by rudyegenias — 28 2007f September, 2007 @ 4:09 am | Reply

  31. Might I add that it has been my experience that I had to turn off my McAfee Security Suite to get the database connection to work with XAMPP running.

    Comment by ATinsley — 31 2007f October, 2007 @ 6:24 pm | Reply

  32. Thanks ATinsley for visiting.

    I have no personal acquaintance with McAfee Suite but there should be a setting there to allow programs to access ports. Just the same as any other software firewalls in the market.

    Cheers!

    Comment by rudyegenias — 2 2007f November, 2007 @ 3:39 am | Reply

  33. Hey Rudy, hope u can assist man. I’ve installed MAMP, but havin’ issues seeing MAMP startup page, this is the message I get. Then I also have a problem logging onto phpMyAdmin, and this what I get there: #1045 – Access denied for user ‘root’@'localhost’ (using password: YES).
    I’m basically trying to setup a website using CMS made simple and kinda need to get the above sorted before I can go any further.
    Thanks a stack man

    Comment by Sedick — 28 2008f February, 2008 @ 8:16 am | Reply

  34. OOOOPPPSSS! that error message : Error: Could not connect to MySQL server!-I’m almost the problem is related

    Comment by Sedick — 28 2008f February, 2008 @ 8:19 am | Reply

  35. im trying to serve from my home pc and the server is running, ppl can connect, i could connect to the database i created a new user with a password and i also created 2 databases, installed some stuff like a php boards and a php based vdeck. I could access database successfully with both apps, then looking around I see that in phpmyadmin i need to change the settings to a config.inc.php, did the proper adjustment according to the guide. But since then i cannot access my database anymore; it says access is forbidden to phpmyadmin. I had changed only root to my loginname i created earlier added the pass, and i changed the port to the port im using for the server had to use something different than port 80 to make it work. So i went back and run EDIT again and put it back like it was, but even that didnt seem to fix it! I’m clueless, need some help please, thx in advance any advice would be greatly appreciated.

    Comment by Tuvok — 25 2008f March, 2008 @ 10:51 pm | Reply

  36. @Sedick and Tuvok: Afaik, you need to set the password in the config file to the root(or another user with sufficient privileges)’s password. So long since I touch this part of my config. Tell me if this helps.

    $cfg['Servers'][$i]['user'] = ‘root’; // MySQL user
    $cfg['Servers'][$i]['password'] = ‘xxxx’; // MySQL password (only needed

    Comment by rudyegenias — 27 2008f March, 2008 @ 1:25 am | Reply

  37. How to start creating a database in phpmyadmin?

    Comment by aman — 4 2008f April, 2008 @ 3:22 pm | Reply

  38. I have xampp version 1.6.6 on red hat linux.
    After running /opt/lampp/lampp security and setting password,
    the phpmyadmin create new database utility is showing “No privilges”.
    In my phpmyadmin/config.inc.php file there is no line for changing mysql password.
    here is the file. please help me what to do so that i can browse my databases.

    Comment by Divya — 6 2008f June, 2008 @ 2:57 pm | Reply

  39. I keep doing what’s repeated in all these messages: Change Root password in phpMyAdmin, then change it in config.inc.php… And still get the same message: “#1045 – Access denied for user ‘root’@'localhost’”!

    I’ve tried with the controluser pw, changing between http/cookie/config, etc.

    I also get “phpMyAdmin was unable to read your configuration file!” and via the link, the message “syntax error, unexpected T_VARIABLE in xxx\config.inc.php on line 1 (there’s only 1 line, but when I split it up, it seems to be in “$cfg['blowfish_secret'] = ‘xampp’;” … which I never changed!

    Any ideas?

    Comment by Newrone — 27 2008f June, 2008 @ 10:00 pm | Reply

  40. hi i have installed wamp server and i created a password for my root user and which was empty at the first. I used the above steps to create password. It worked fine for me. In command prompt i get to login with the password i created. But when i open my phpMyAdmin page it shows the same error as “#1045 – Access denied for user ‘root’@'localhost’ (using password: YES)”

    If there is a solution to recover from this.. LET ME KNOW..
    Thanks in advance.

    Comment by Saravanan — 14 2008f August, 2008 @ 6:54 pm | Reply

  41. Hi…I’ve tried all sorts of combos to get rid of my “Error: Could not connect to MySQL server!” that appears when I try to log on to myphpadmin home page. I was building a php page that connected to my database when I realized that I either needed to reset, or create a password. I don’t remember the password I entered when I originally installed MAMP.

    So I reset it in two places in myphpadmin. The first was lower down on the permissions page and it seemed wrong (sorry that’s poorly described, but I can’t access the page any more, hence the problem). Then I changed it somewhere in the middle of the page and that worked – the php page I was building worked. And the weird thing is that it STILL WORKS.

    So, I’ve added the password I use in that php page to the config.inc.php page, but nothing works. I’ve tried setting the password to blank. I’ve restarted MAMP every itme. I’ve set the user to blank. I’ve added a controluser. Nothing works. What am I doing wrong, and why is my php page still working, but not myphpadmin?

    Thanks!

    Comment by Stacia — 29 2008f September, 2008 @ 12:08 pm | Reply

  42. thanks for the info, basically the same though, yet using nano to edit the file. anyway, this post attempts to be neutral in OS choice and in editor. cheers and smile.

    Hello, during the instalation of XAMPP when changing all passwords, you are prompted to enter new password for user ‘pma’ and when you log in to phpmyadmin with pma/pass, you can’t create DB. All you have to do is this (Linux users only):

    sudo nano /opt/lampp/phpmyadmin/config.inc.php

    -find these lines:

    $cfg['Servers'][$i]['user'] = ‘root’;
    $cfg['Servers'][$i]['password'] = ”;

    -enter password and save (contr+o -> enter) the file.

    Now log in phpmyadmin with root/your-new-pass.

    Comment by Ivan Valkov — 9 2008f November, 2008 @ 5:10 am | Reply

  43. Iirc, you need not create a config.inc.php, rather it’s located here: C:\xampp\phpMyAdmin\config.inc.php on Windows installation.

    I’m trying to set up xampp locally for cms work, and
    there’s no problem getting it working. However, as soon
    as I use the command line per this page:

    http://www.apachefriends.org/en/faq-xampp-windows.html#password0

    ..I can no longer get phpmyadmin to access the server.

    I’ve followed the directions exactly to the letter
    more than once, creating a config.inc.php file and
    altering the pw there, but it always fails to work.

    No one else seems to be having this issue, what am
    I doing wrong?

    Comment by Big John — 4 2008f December, 2008 @ 5:43 am | Reply

  44. Open http://localhost/ or http://localhost:/ and select English when asked for language. There’s a security link on the left part of the web page, I suggest checking that for configuration or security check for xampp.

    Okay, I tried reinstalling again and used method 2 to change
    the pw, and that seemed to work, but now phpmyadmin continues
    to inform me that my pw is nothing and this is a security hole.

    Is there any way out of this madness?

    Comment by Big John — 4 2008f December, 2008 @ 6:00 am | Reply

  45. Please give us further info, such as, did you changed any of the password on xampp etc. This will give us further links to the issue.

    No Privileges is coming below the Create New Mysql database in phpmyadmin 2.10.3

    Please help me how can i create new databse in phpmyadmin

    Comment by Haseeb — 4 2008f December, 2008 @ 4:40 pm | Reply

  46. Try to change the password for root in the config file of phpMyAdmin.

    Hi All,

    Here I install xampp on ubuntu and change root password at the time of installation. Now I can not create database trough PHP myadmin as it shows “No Privileges” in my php myadmin. I tries method for changing “config” to “cookies” in config.inc.php file and it allows me to enter into PHP myadmin but not allow me to create DB..

    Please help

    Comment by Hiral Thaker — 1 2009f January, 2009 @ 3:15 pm | Reply

  47. How about re-installing? Sorry, I am using a Windows machine.

    hello,
    I have installed Xamp on ubuntu in opt folder but i have given 777 permission to opt folder by mistake & after phpmyadmin is not working can any one suggest me what to next?

    Thank in advance

    Comment by chandraprakash — 9 2009f March, 2009 @ 10:23 pm | Reply

  48. Im totaly new at this, and I run windows xampp.

    I opened config.inc.php with wordpad, and changed this:

    $cfg['Servers'][$i]['user'] = ‘randomUser’;
    $cfg['Servers'][$i]['password'] = ‘randomPassword’;

    and now when I tried to acess my phpmyadmin I get problem 1045, and I dont know what to do. I tried to refresh. but still no luck. any idas?

    Is randomUser a legitimate user in MySQL? Remember that it should be one of the user. Also may I have the complete error message?

    Comment by Jonathan — 20 2009f June, 2009 @ 12:51 am | Reply

  49. Thank You very much. PhpMyAdmin keeps warning that a password has not been set, but then as soon as the problem is fixed it gives no information on how to gain access again. Anyway, I appreciate your helpful post, problem solved.

    -Nathan

    Comment by Nathan — 16 2009f July, 2009 @ 3:40 am | Reply

  50. Thanks.

    Comment by Kelvin — 17 2009f July, 2009 @ 6:07 am | Reply

  51. wohaaaa!! yeppeee i had the same prob mentioned above and this is the first page i entered looking for the answer and i GOT it!!! yoooooooooo. thanks alot my friend….

    Comment by Achin Sharma — 26 2009f July, 2009 @ 5:16 am | Reply

  52. @Nathan, Kelvin, Achin: You are most welcome.

    @Cheved: Basically it’s the same, try to set mysql root password first then follow above instructions.

    i am using wamp server with php and mysql and i want to change the default password for phpmyadmin to be something instead of empty but everything i try just locks me out of phpmyadmin and tells me access denied.
    any solutions?

    Comment by yo — 6 2009f August, 2009 @ 12:28 am | Reply

  53. you saved my life! Thanks!

    Comment by KungFu — 13 2009f August, 2009 @ 10:31 am | Reply

  54. Hello all,

    after I installed phpmyadmin , I’ve been trying to login but I have an error message

    “#1045 – Access denied for user ‘ahmed’@'localhost’ (using password: YES)”

    Note : there is another user ‘root’ with respective password , but I get the same error message when trying logging in using ‘root’ user name ans password

    Comment by Mico — 22 2009f August, 2009 @ 8:36 am | Reply

  55. hai
    i installed wamp server… wen i try to take localhost its asking username and password… and phpmyadmin is not working…

    Comment by Anand — 4 2009f October, 2009 @ 1:02 am | Reply

  56. Just wanted to say thanks for your help on this one! :)

    Comment by RSpace — 6 2009f November, 2009 @ 12:23 am | Reply


RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.