MySQL Change root Password

by on January 2, 2006 · 120 comments· last updated at April 12, 2011

How do I change MySQL root password under Linux, FreeBSD, OpenBSD and UNIX like operating system over ssh / telnet session?

Setting up MySQL password is one of the essential tasks. By default root user is MySQL admin account user. Please note that the Linux / UNIX root account for your operating system and MySQL root are different. They are separate and nothing to do with each other. Sometime your may remove mysql root account and setup admin as mysql super user for security purpose.

mysqladmin command to change root password

If you have never set a root password for MySQL server, the server does not require a password at all for connecting as root. To setup root password for first time, use mysqladmin command at shell prompt as follows:
$ mysqladmin -u root password NEWPASSWORD
However, if you want to change (or update) a root password, then you need to use the following command:
$ mysqladmin -u root -p'oldpassword' password newpass
For example, If the old password is abc, you can set the new password to 123456, enter:

$ mysqladmin -u root -p'abc' password '123456'

Change MySQL password for other users

To change a normal user password you need to type (let us assume you would like to change password for user vivek) the following command:
$ mysqladmin -u vivek -p oldpassword password newpass

Changing MySQL root user password using MySQL sql command

This is another method. MySQL stores username and passwords in user table inside MySQL database. You can directly update password using the following method to update or change password for user vivek:

1) Login to mysql server, type the following command at shell prompt:
$ mysql -u root -p

2) Use mysql database (type command at mysql> prompt):

mysql> use mysql;

3) Change password for user vivek, enter:

mysql> update user set password=PASSWORD("NEWPASSWORD") where User='vivek';

4) Finally, reload the privileges:

mysql> flush privileges;
mysql> quit

The last method can be used with PHP, Python or Perl scripting mysql API.

See also:

Updated for accuracy!



You should follow me on twitter here or grab rss feed to keep track of new changes.

Featured Articles:

{ 118 comments… read them below or add one }

1 Tabitha June 5, 2007 at 3:34 pm

I got an error trying to use your method to change the root password using mysqladmin. I did some checking and found that the following method worked.

mysql> mysqladmin -u molly -p password NEWPASSWORD
(replacing NEWPASSWORD with the desired password, you will be prompted to enter the current password)

Reply

2 Rajamohan July 1, 2010 at 5:59 am

Which Operating System you used….

Reply

3 LUCAS` July 31, 2010 at 2:24 pm

This site is a mess !!!, now i can’t access to mysql *@*&#*&@)(***@)( you !!!

Reply

4 Henrique January 24, 2011 at 7:11 pm

Lucas, you’re an idiot

Reply

5 idiots March 1, 2011 at 10:37 am

Bullshit!!

Reply

6 John August 10, 2011 at 3:37 am

This was extremely helpful. its a simple query really… Just needed the correct syntax. Thanks administrator.

Reply

7 jim August 11, 2010 at 6:31 pm

This is old, but someone might see it. Don’t forget to put the single quotes around your password.

Reply

8 Dhananjaya July 30, 2011 at 2:18 pm

Really good post:

i hacked my root by using that type + batch file
Because i used special carectors for my password
Thanks again ;)

Reply

9 Samuel June 6, 2007 at 10:44 am

I am using the latest MySQL, the codes above didn;t work for me, please if you have the correct code to use. I want to change the root password to null. Just like it came.

Thanks

Reply

10 al August 9, 2011 at 7:13 am

mysql>SET PASSWORD FOR ‘root’@'localhost’ = PASSWORD(‘secret_password’);

Reply

11 Josh September 5, 2011 at 7:48 am

Al, thx. That worked fine for mysql. However when I try to access mysqladmin
app now, I get a strange error.

“The additional features for working with linked tables have been deactivated.”
anyone have an idea for a fix?

Reply

12 Deirdre October 6, 2011 at 9:28 pm

Hello, I need help creating a password. I don’t know where I am supposed to enter the SET PASSWORD command.

Reply

13 Edd June 18, 2007 at 11:18 am

computers can be sucha pain..!!

THANKS!

Reply

14 yesh December 20, 2007 at 4:57 pm

Yessssss… same for me…
It will not work.
I use WAMPSERVER 2.0
I get following error in Mysql:

ERROR 1064 (42000): You have an error in you SQL syntax; check the manual that corresponds to your MySql server version for the right syntax to use near ‘$ mysql -u root -p
mysql> use mysql
mysql> update user set password=PASSWORD(“NE’ at line 1

Very annoying

Reply

15 Josh September 5, 2011 at 7:50 am

I’m using wamp server 2.1. Click on your wamp icon. mouse hover on Mysql
select console then type in Al’s suggestion. It worked fine for me.
you may have to refresh your page or clear cookies before you see the change.
I know I had too.

Reply

16 Josh September 5, 2011 at 7:53 am

oh yeah, if it asks you for a password and you haven’t set one yet, just press
the enter key.

Reply

17 kingsley mbonu January 31, 2012 at 2:46 pm

i want to set configure my mysql to set a new password i typed set password and the reply is this ERROR 1064 (42000): You have an error in you SQL syntax; check the manual that corresponds to your MySql server version for the right syntax to use near ‘$ mysql -u root -p
mysql> use mysql
mysql> update user set password=PASSWORD(“NE’ at line 1

Reply

18 K.Ramanathan February 6, 2008 at 6:37 am

The information on your website has helped me. Thanks.

Best Wishes,
K.Ramanathan

Reply

19 Alexander Elo March 17, 2008 at 11:49 pm

Thank you very much, this information was usefull!

- Alexander Elo

Reply

20 hardyboyz April 25, 2008 at 5:35 pm

If I forgot my mysql password? how is it going?, because there is a step that need an old mysql password.

Reply

21 Inder September 21, 2011 at 7:15 am

ya I lost my Brain also :)

Reply

22 vivek April 25, 2008 at 7:02 pm

Go here to recover mysql password.

Reply

23 ryan May 14, 2008 at 2:33 am

Worked like a charm, thnx.

Reply

24 jessica July 17, 2008 at 2:06 pm

thank you so much. i really needed this. ^^

Reply

25 Eutycus August 12, 2008 at 6:40 am

mysqladmin -u root -p password “newPassword” {enter}

{prompt}
Enter password:”oldPassword”

Reply

26 Hendry Lee September 8, 2008 at 1:30 am

To update mysql password for root, the command that works for me is:

mysqladmin -u root -poldpass password newpass

Reply

27 Daniel September 10, 2008 at 2:41 pm

mysqladmin -u root -p password ”

this will remove your password

Reply

28 dep August 9, 2011 at 2:22 pm

Careful not to copy paste this. Use two single quotes instead of what you’d get if you copy/pasted this line.

mysqladmin -u root -p password [singlequote][singlequote]

Reply

29 Bob September 23, 2008 at 3:06 am

I found this quite frustrating. Not an ideal post about how to change the root pwd. Hate it.

Reply

30 vivek November 14, 2008 at 5:37 am

brendon,

Whats wrong?

Reply

31 scott November 26, 2008 at 7:56 pm

Have been coming here for years to cut and paste that syntax

mysqladmin -u root password NEWPASSWORD

works great, guys the “NEWPASSWORD” is where you put the new password

it is lazier for me to come here to grab it than learn it myself, i

Reply

32 Spam Script November 26, 2008 at 8:55 pm

There are people out there that should not be using computers, as yesh, bob & brendon.

Reply

33 Bhong December 2, 2008 at 11:45 pm

Thanks for sharing this very useful info.

Reply

34 MIke nutt December 12, 2008 at 1:46 pm

HI! It worked for me changing password this way, but when I trying to flush privileges it says : ERROR 1146 (42S02): Table ‘mysql.servers’ doesn’t exist.
Whats wrong???

Reply

35 Vinod Rawat January 4, 2009 at 1:00 pm

I was playing with WAMP tool. By default it had root password as empty. I wanted to provide a new password and not just leave it empty.
By this I will be giving simple steps which I learnt, where in one can make necessary changes for both mysql server and mysql client. Hopefully this will work perfect with any standalone mysql server and mysql client application. I hope this may save someones precious time.

WAMP Settings for MySQL
———————————-
By default WAMP does not set the mysql root password.
So phpmyadmin connects to internal mysqlServer with default username : root and empty[NO] password

If we want to have some form of secure database then root password should not be left empty.
How to provide the password so that mysql client connects to the server with some password?

The following tries to simplify the approach in WAMP Mysql setup.
Mysql Server End Changes for new Password
————————————————————–
Change the mysql server password as follows :
To setup root password for first time:
mysqladmin -u root password “NEWPASSWORD”
C:\wamp\bin\mysql\mysql5.1.30\bin> mysqladmin -u root password "root"

If password already exist and you are aware of it and want to change it then
1. Thru mysqladmin technique :
mysqladmin -u root -p password “MYNEWPASSWORD”
Enter password: OLDPASSWORD

C:\wamp\bin\mysql\mysql5.1.30\bin>mysqladmin -u root -p password “vinod”
Enter password: root

2. Alternatively, [Optional Step]
C:\wamp\bin\mysql\mysql5.1.30\bin>mysql -u root -p
Enter password: root [OLD EXISTING ROOT PASSWORD]
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.1.30-community-log MySQL Community Server (GPL)

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql> use mysql
Database changed

mysql> update user set password=PASSWORD("vinod") where User='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> exit
Bye

This changes the root password.

Verify :

C:\wamp\bin\mysql\mysql5.1.30\bin>mysql -u root -p
Enter password: vinod
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.1.30-community-log MySQL Community Server (GPL)

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql>exit
C:\wamp\bin\mysql\mysql5.1.30\bin>

————————————————————————————

Mysql Client End Changes for new Password
———————————————————
Change the mysql client password as follows :
Here phpmyadmin is a mysql client application which is connecting to mysql server.
Let us see what it requires to make changes to successfully connect with new password

1. Edit config.inc.php under C:\wamp\apps\phpmyadmin3.1.1\

Change
$cfg['Servers'][$i]['password'] = '';
to
$cfg['Servers'][$i]['password'] = 'vinod';

Thats it restart mysql service and http://localhost/phpmyadmin/ will let u login

Reply

36 Vivek Gite January 4, 2009 at 1:04 pm

Thanks for sharing Windows specific information.

Reply

37 Rick September 17, 2010 at 3:05 am

Awesome! Thanks for saving me a ton of time!

Reply

38 Little Box October 30, 2010 at 12:39 pm

Thank you for this info. I tried to change the password in the my,ini file (i’m a beginner), but it didn’t work. i searched on google, and I found this :D Very useful.
I’ll make a post on my blog about this :D

PS: Don’t be affraid Vivek, I won’t copy your post ;)

Have a great day!

Reply

39 Dare November 29, 2010 at 6:56 pm

vinod,

thank you so much. This detailed tutorial helped me change the password in 5 min.

Dare

Reply

40 Patrick March 17, 2011 at 2:56 pm

Thanks Vinod!!!!!!!!!

Your solution is the only one that worked.

Reply

41 Jnanesh January 6, 2009 at 11:03 am

Thanks Vivek.
It worked for me.

Reply

42 josh from america January 13, 2009 at 11:06 pm

Windows is the festering bit of useless tripe that you hope does not appear on your porch, but if it does you kick it off and wash your shoe.

Keep it in joke computing world and off of serious informative boards please.

Reply

43 Unbiased January 21, 2009 at 10:06 pm

Operating Systems are SRS BSNS.

But seriously, get over yourself, “Josh from America”, and stop posting such self-righteous fodder. No one cares what you think. This is supposed to be an area for assistance.

Reply

44 morg January 29, 2009 at 9:40 am

when setting the root password for the first time, start a DOS terminal and run
C:\wamp\bin\mysql\mysql5.1.30\bin> mysqladmin -u root password “root”
like in vinod’s post. here the ‘mysqladmin’ is not a command, but an exe file!

yesh: do NOT use mysql console for this, because it does not recognise the command, and you keep getting new prompts and error messages.
first I made the same mistake. Thanks Vinod!

Reply

45 HappySpaceInvader February 10, 2009 at 10:47 am

The problem with your examples, is that it is not clear which parts are literal and which parts are to be substituted.

I have been trying to get your example to work to change the existing root password, but in your example of: “mysqladmin -u root -p oldpassword newpass” are both of the last two arguments meant to be substituted or just the first one. And then, at the prompt, do I enter the old password, or the new one I want to create? It’s terribly unclear.

Reply

46 HappySpaceInvader February 10, 2009 at 10:58 am

Here is a foolproof way of changing your root password without mucking around with prompts and error messages:

mysqladmin –user=root –password=’my_old_password’ password ‘my_new_password’

Reply

47 charu February 16, 2009 at 11:23 am

My user name and password are not working while I am opening my ID. It says this is not a valid ID but i gave correct ID and password. I want my previous ID and password because this is my favourite ID

Reply

48 kathirvel March 18, 2009 at 5:12 am

nice one helped me in time

Reply

49 Kenneth Gustine March 27, 2009 at 6:45 am

To clear the root password I got a “too few arguments” with

mysqladmin -r root password

instead, mysqladmin -r root password “” ( MUST be double quotes )

I then entered the root password and this cleared it.

Reply

50 ThunderGod March 30, 2009 at 10:12 pm

tnx it worked but i changed it a little i used this
mysqladmin -u root -poldpass password Newpass

Reply

51 Andy Towler April 9, 2009 at 8:19 am

Thanks go to Vinod Rawat – a useful and easy to follow comment, resolved my issue in 2 minutes flat.

Reply

52 gorg April 16, 2009 at 1:30 pm

Thank you very much for this information. I have been searching for hours on a correct technique for something as simple as changing the passwords of mysql users and most pages are just plain wrong with continuous comments complaining about failure. I hated being apart of that failure. I found your site and the solution was simple and correct. This has made me much more productive with my sites by not having to continuously change the username and password in the site code. Thank You!

Reply

53 Dan May 13, 2009 at 7:28 pm

Hey thanks!, quite frankly, the windows tip got it done in a snap! o.O… who says open source is free… it’s only free if your time is worthless :o!

Reply

54 rahul May 29, 2009 at 12:22 am

I login via SSH to my server, and then, into of my vps, write “mysql” and I can access (not need put root psswd mysql).

Can you help me?.

Reply

55 Ankur Kaushik June 12, 2009 at 10:15 am

Excellent……………..:)

Reply

56 Sureshkumar June 22, 2009 at 9:12 am

Superb !!!!!!!!!!!!!!!

Reply

57 john black June 29, 2009 at 10:36 am

Thank you for your help.
mysqladmin -u root -p’oldpassword’ password newpass
Before successfully changing my password using your script I got single quotes around my new password (and a warning.) So I did like this:-
mysqladmin -u root -p”‘oldpassword’” password oldpassword
It worked! What a performance!
Linux seems easier than Windows XP.

Reply

58 khan July 4, 2009 at 9:56 pm

The above command did not work for me, perhaps i am using latest version of mysql but the following did

C:\xampp\mysql\bin>mysqladmin -u root -p”1234″ password “”

1234 is old password. New password is blank. I tried different variation but it never worked. It did not ask for password confirmation this time and i was able to login using a blank password. Note that i used double quotes to wrap both old and new password. Hope it helped. I am using MySQL 5.1.29 which i believe is latest.

Reply

59 john black July 5, 2009 at 11:58 am

I suggest that it is different for different versions and between Windows and Linux.
I suggest that you, Khan, have changed your password to “” which will be treated as no password.
What you did that worked was:
C:\xampp\mysql\bin>mysqladmin -u root -p”1234″ password “”
I suggest that it might have worked without the double quotes.
Now that I have got it working I really don’t want to try it and mess up my system.

Version 5 is the first version of Mysql that I have managed to make work.
I have installed many earlier versions and have always come unstuck about the password.
It really is a nightmare.
I am not a giant corporation with hackers trying to steal my credit card info using code injection.
I am just a home user who wants to learn Mysql.

Reply

60 sandeep July 11, 2009 at 3:49 pm

I get an error for the flush privileges command – error 1146 (42s02): Table ‘mysql.servers’ doesn’t exist

Is reloading the privileges very important – or will this not affect at all?

Reply

61 yudymardianto July 28, 2009 at 4:09 am

very Useful this article.
thanks.

Reply

62 jason August 19, 2009 at 6:20 pm

5.1.37
mysqladmin -u root -p”oldpass” password”newpass”

replace oldpass with your old password. replace newpass with your new password. leave the quotation marks “”.

thanks again for this post , esp thundergod.

Reply

63 Ste ve August 21, 2009 at 4:20 pm

This just doesn’t work. I have version 5.0.84 on a windows server.
It doesn’t work without quotes, with quotes, double quotes or brackets…

I’ve never set a pasword, so I just try
$ mysqladmin -u root password NEWPASSWORD

And it doesn’t work. Please help.

Reply

64 edi September 5, 2009 at 10:10 am

hello i am just use wamp but when i open phpmyadmin , i found this alert ,
“Your PHP MySQL library version 5.0.51a differs from your MySQL server version 5.1.32. This may cause unpredictable behavior.”

can anybody help me to fix this ?

Reply

65 john black September 6, 2009 at 12:17 am

Hello edi,
I see that you are having problems too.
Welcome to the club.
“Your PHP MySQL library version 5.0.51a differs from your MySQL server version 5.1.32. This may cause unpredictable behavior.”
I have never used wamp precisely because of this sort of problem.
If all goes well wamp is a very easy way to install Apache, PHP and MySql.
But when something goes wrong as in your case it is very difficult to fix.
I think that your error message means exactly that.
Had you installed the three packages separately it would have been less trouble.
Before you uninstall wamp and install Apache, PHP and MySql separately,
I would try uninstalling MySql, uninstalling PHP and then installing PHP and then MySql.
You do need to download PHP and MySql separately.
But having said that you might be better off starting again
with a fresh install of Apache, PHP and MySql.
Each is dependent on the previous installation thus Apache can run on its own.
PHP depends on Apache. MySql depends on PHP.
You must work up to the full installation, uninstalling a part if it does not work.
Just to add a layer of complication, for some reason PHP no longer supports MySql
without a few extras. Some dispute between Sun Microsystems who support MySql
and PHP which is open source.
Your C:\PHP\ext folder needs to include a few extra dll files
which need to be enabled in your php.ini.
I could say more but it is well documented on the internet.
Yes it is a challenge. Good luck. It will work eventually.

Reply

66 Srikanth September 15, 2009 at 6:57 am

Thanks a Lot :)

Reply

67 nicoliniyo November 3, 2009 at 2:09 pm

This is really usefull!

Reply

68 pictuality February 15, 2010 at 8:42 pm

Hi all,

Am using WAMP – with MySql 5.1.36.

Currently have no password set for root. Open to all. None of the above solutions work for me. Does anyone know how to set root password – WAMP Mysql 3.1.36 ? Please don’t suggest any of the above!

Thanks

Reply

69 pictuality February 15, 2010 at 11:36 pm

Hi Vinod,

Hope you can help.

You say that to set a password (in WAMP when one hasn’t been set) to:

To setup root password for first time:
mysqladmin -u root password “NEWPASSWORD”
C:\wamp\bin\mysql\mysql5.1.30\bin> mysqladmin -u root password “root”

I don’t understand, – which one is it?

Do I use your first line and enter my chosen password where you have “NEWPASWORD”
or do I use your second line and enter “root” ?

If I use your second line and enter “root”, do I then get to set the password I want?

Why do you give two conflicting lines? Sorry, all new to me.

I also found out from another site that you have to navigate from command prompt to the bin directory that contains the mysqladmin.exe file before trying to run the command. That isn’t very clear here.

Reply

70 sphiwe February 18, 2010 at 9:27 am

hi all.
iam usin wamp 2.0 with mysql 5.1.36.

i hv 2 tables, subjects and pages, pages relates to subjects vai subject_id. iam buildin a site, wen i try 2 retrieve pages 4rm my data base dat hv a relationship with a subject(…$query = select * FROM pages WHERE subject_id = {$subject_id}…) it gvs me an error dt reads: you hav an error in ur sql syntax; check manual that corresponds to your mysql server version. somebody please help me, thanx.

Reply

71 Greg March 12, 2010 at 11:06 pm

When I tried this, it didn’t seem to change the mysql password..

not to fear though I did find the fix.

Note: If your mysql user account doesn’t have root access it can’t read the .sql script you just created. Easy way around it is to make the file in /tmp or have your mysqld_safe running with root privileges. other wise works like a charm.

Reply

72 boriss March 18, 2010 at 7:35 pm

Thank you very much, this information was usefull!

Reply

73 gary April 8, 2010 at 8:18 pm

Apparently, I fat-fingered the password for my root. I have attempted to use the posts here, and quite likely overlooked the solution. However, is there a simple command to clear the password if it is not remembered? I am guessing that reinstalling mySQL would not work because this is stored in the registry, so my next question is where I find that. I have full admin rights and this is my box, but I obviously went astray and need the program for a college class.

All help is greatly appreciated.

g.

Reply

74 gary April 8, 2010 at 8:22 pm

As a follow up, I am using a Dell 1640 XPS with 64-bit operating system and mySQL server 5.1.

g.

Reply

75 Jack July 13, 2010 at 7:35 am

I am running a local MAMP server on my MacBook Pro (Mac OS X – 10.6.4) and running MySQL 5.1.48 (x86_64) and found out that the following command would cause root to longer have access to the “mysql” database after logging out and logging back in:
mysql> update user set password=PASSWORD(“NEWPASSWORD”) where User=’root’;

The fix was to replace the double quotes with single quotes around the new password in the sql statement. So the command looked like this:
mysql> UPDATE mysql.user SET Password=PASSWORD(‘newpassword’) WHERE User=’root’;
Also don’t forget to refresh the grant tables with this command:
mysql> FLUSH PRIVILEGES;

But what I recommend is using the SET PASSWORD syntax b/c the update will let you pass any value which could cause trouble and headaches, plus its just a longer command.
mysql>set password for ‘root’@'%’ = password(‘newpassword’);

Reply

76 Pule July 21, 2010 at 3:52 am

Thanks you very much. I spent the whole day searching for this. Yay!!!

Reply

77 Tash Pemhiwa July 28, 2010 at 1:31 pm

Brilliant! Had checked the mysqladmin command but was in doubt. Thanks for clearing up my doubts. Worked perfectly!

Reply

78 Camilo September 20, 2010 at 12:03 am
79 ric September 26, 2010 at 8:40 am

Good Day! i have system in server and it runs in linux(fedora 6),a program(system)php and mysql,the system is in www folder in linux,now i want it to run in windows xp,i installed wamp in my windows xp,i copy and paste the system(which is the system in linux) in www folder under folder wamp(c>wamp>www),i start all services(php,mysql,apache),i open phpMyAdmin and import the sql files(which is i exported from linux phpMyAdmin, compose of tables etc…)..and then i try to run the system using hxxp://localhost/system/index.php, it runs like in linux,now asking the username and password like in linux as administrator,when i entered username and password like in linux,or even wrong or none,it has an error.it appears ”
Not Found

The requested URL /system/Notice: Undefined variable: PHP_SELF in C:\wamp\www\system\index.php on line 55 was not found on this server.”

then if i import sql file in phpmyadmin,this information appear “Your configuration file contains settings (root with no password) that correspond to the default MySQL privileged account. Your MySQL server is running with this default, is open to intrusion, and you really should fix this security hole by setting a password for user ‘.root’.

WHAT HAPPENED?WHAT SHOULD I DO FOR IT?THANKS GUYS…im looking forward for ur help…thank you and GOD BLESS!

Reply

80 Dr. Mussadiq L November 6, 2010 at 6:09 am

thank you believe me its fantastic. God bless you. Allah will give you the reward for spreading useful knowledge. love you . thankkkksss it solved my problem keep posting data like this

Reply

81 Said November 14, 2010 at 1:36 am

Hi, would like to say thank you – I followed your advice and it worked for Wamp 5 (thought I had lost several websites I’m developing before I came across your post). Brilliant and God bless you. Said

Reply

82 James Aaron Devlin November 18, 2010 at 9:26 am

Thank you very much Vivek.

Reply

83 Ali Abid November 30, 2010 at 9:43 am

Excellent article. Simple but with most useful information in excellent manners.

Reply

84 kamal December 26, 2010 at 1:23 am

Its worked although searching many websites.I work on SUSE 11.3.
Thanks a lot

Reply

85 ferrero January 13, 2011 at 10:11 pm

Thanks, its works fine for me.

Reply

86 thenoid January 29, 2011 at 11:17 am

Very thank you! =)

Reply

87 Deepak February 18, 2011 at 3:38 am

Can any please solve this problem?

[deepak@localhost]$ mysql -u root -p mysql123
Enter password:
ERROR 1045 (28000): Access denied for user ‘root’@'localhost’ (using password: YES)

Reply

88 Oscar D'Antona February 24, 2011 at 11:15 pm

Thaks a Lot !!!!!!! that was was easy
you were very clear
thak you
unixrat

Reply

89 Gabriel LopezSeco March 16, 2011 at 7:42 pm

I have consistently found the information on this website very helpful. Especially during my beginning into Linux.

I’ve seen some harsh comments here, that I think may be completely unfair.

Reply

90 DynoDan March 30, 2011 at 7:16 pm

I realize this is an old post, but someone like me may stumble on to this issue. I am currently using mysql version 5.0.91 and this is what worked for me. When using the command line shown below, one thing to remember is that there is no space between the -P and the password. There is however spaces between -u and root, and between password and “newpass”.
mysqladmin -u root -p”oldpass” password ”newpass”

So, if the old password was abcde, and the new password is fghij, the command line would look like this:
mysqladmin -u root -pabcde password fghij

if you enter this like this, with the space between -p and abcde, mysql will prompt you for a password, and further will not recognize the abcde as a valid command.
mysqladmin -u root -p abcde password fghij

I am not sure why this is, but I can say this worked for me.

Reply

91 Chris April 6, 2011 at 7:07 am

Hi,
How to change the domain name in the database table?

Having to use a another mysql wordpress database for another domain/site, I need to change the domain name inside the database but have no idea which table/s containing the domain name and how to change it.

Any assistance and guidance would be much appreciated.

Thanks in advance
Chris

Reply

92 Jared April 12, 2011 at 8:58 pm

Thanks for this info. Worked great!

Reply

93 Rupesh April 25, 2011 at 12:12 pm

Thanks it helped.

Reply

94 NargoT May 5, 2011 at 3:09 pm

Thank you !!!!!!!

Reply

95 bruce June 10, 2011 at 11:27 am

how do I change my entery password to my computer.

Reply

96 Edwin July 8, 2011 at 11:56 am

i got problem when i login i enter the user name but password i didn’t know

Reply

97 Askar Ali September 12, 2011 at 9:59 am

Thanks for sharing.

Reply

98 rahardja September 14, 2011 at 3:11 am

Tengs, that’s really help me ..now my local web can work properly . :)

Reply

99 tamashebi September 22, 2011 at 9:01 am

I cant change my password on fedora.
I have this warning. error: ‘Access denied for user ‘root’@'localhost’ (using password: NO)’
please help

Reply

100 Inder September 23, 2011 at 7:13 am

SOLUTION TO ALL YOUR PROBLEMS

Search for a file “config.inc.php” you will find it in “wamp\apps\phpmyadmin3.2.0.1″ like folder

just change the password in this file on line looking like “$cfg['Servers'][$i]['password'] = ‘password’; ”

then Save !

Done

Reply

101 akshay November 3, 2011 at 10:41 am

Thank you..! Worked fine…!

Reply

102 anne December 11, 2011 at 5:48 pm

I am getting these type of errors
—>
MySQL said:

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

—>
Connection for controluser as defined in your configuration failed.

—>
phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.

==========
Actually, earlier http://localhost/phpmyadmin was running fine.. but since i have installed MySQL server, and during configuring the instance i have given a simple password it had stop work and displaying the errors written above.
Also the command presented in this blog are not working at my system’s command prompt.

I m thinking to remove the root password, but i guess there may other solution as well to bypass/remove these type of errors.

Reply

103 Name December 12, 2011 at 5:33 pm

#1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘mysql> update user set password= PASSWORD(“[password]“) where User=’[username]” at line 1

Reply

104 April Hannaford January 18, 2012 at 4:08 am

I just wanted to say thanks for this article. It help save me so much time… Thanks…

Reply

105 José Luis Olmedo M. March 2, 2012 at 8:44 pm

Thank you for your help.
You article is excelent.
Thanks.

Reply

106 tibi June 4, 2012 at 11:39 am

hi,

it works fine but i would not advice to do it like this:
mysqladmin -u root -p’abc’ password ’123456′
because the entered password will be on your console. and will go into your history. this is not secure. when doing it like this:
mysqladmin -u root -p password
the mysqladmin will ask for your old and new password. which will not go into your console and not into your history.

besides this it helped me alot thanks!!

Reply

107 steven June 25, 2012 at 7:01 am

thank you.

Reply

108 bdeveloper July 2, 2012 at 9:27 am

Thanks.

Reply

109 Andrei July 4, 2012 at 10:00 am

For Chris, Download and install WAMP, use PhpMyadmin to RENAME your database(slect your database , chose OPERATION) , I hope you are able to do this! If not, do some Google, for PhpMyadmin .

Reply

110 SUDHAKAR K August 9, 2012 at 12:52 pm

Hi,
Thanks for this tutorial..
really its helpful doc

thanks

Reply

111 moosa August 15, 2012 at 10:09 am

thanks alott..

Reply

112 Notandi November 12, 2012 at 1:21 pm

I had tried everything. Finally bit the bullet, reinstalled Ubuntu worked around the problems that came up in this walkthrough and got it to work in 5 min.

Reply

113 sebro November 26, 2012 at 4:15 pm

Any help appreciated
Broses-MacBook-Pro:~ Watlala$ /usr/local/mysql/bin/mysqld_safe –skip-grant-tables
121126 18:10:56 mysqld_safe Logging to ‘/usr/local/mysql/data/Broses-MacBook-Pro.local.err’.
touch: /usr/local/mysql/data/Broses-MacBook-Pro.local.err: Permission denied
cat: /usr/local/mysql/data/Broses-MacBook-Pro.local.pid: Permission denied
rm: /usr/local/mysql/data/Broses-MacBook-Pro.local.pid: Permission denied
121126 18:10:56 mysqld_safe Fatal error: Can’t remove the pid file:
/usr/local/mysql/data/Broses-MacBook-Pro.local.pid
Please remove it manually and start /usr/local/mysql/bin/mysqld_safe again;
mysqld daemon not started
/usr/local/mysql/bin/mysqld_safe: line 107: /usr/local/mysql/data/Broses-MacBook-Pro.local.err: Permission denied

Reply

114 Sauef Sufal December 12, 2012 at 6:54 am

Thanks very much, i can summarize like that
simply type three commands below noted:

command 1: use mysql;
(prompt will display database changed
command 2: update user set password =PASSWORD(“PUT YOUR PASSWORD HERE”); where user=’root’;
Command 3: fulsh privileges;

Reply

115 Kaniya February 22, 2013 at 4:41 pm

better way before upgrade older version of phpmyadmin take the backup. and after replace the config.ini.php from old version.

it is working

above all the other fuckers are liars… i hate

Reply

116 Betta March 6, 2013 at 11:57 am

Great job ..guys..it helped me …10x..

Reply

117 Joye March 22, 2013 at 8:40 am

Thanks a lot !!
You just saved my ass :) It was really a great help!!

Reply

118 DexCript April 11, 2013 at 7:51 pm

Very Helpfull this article, it will work for some users and not for others ( diferente mysql version, or different mysql client etc… ), before posting crap about, looking in your environment….. so dummies!!!

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <kbd> <blockquote> <pre> <a href="" title="">

Tagged as: , , , , , , , , , , , , , , ,

Previous Faq:

Next Faq: