MySQL Lost Password: Difference between revisions
m
Reverted edits by Upazixorys (Talk); changed back to last version by Ric
Upazixorys (talk | contribs) No edit summary |
m (Reverted edits by Upazixorys (Talk); changed back to last version by Ric) |
||
Line 1: | Line 1: | ||
{{Uc nav mysql}} | {{Uc nav mysql}} | ||
'''Lost Password''' | '''Lost Password''' | ||
Line 6: | Line 5: | ||
On refreshing the page received this error message: | On refreshing the page received this error message: | ||
<nowiki>#</nowiki>1045 - Access denied for user 'root'@'localhost' (using password: YES) | |||
He then went into apanel used '''MySQL Server Configuration''' to set this new password and received the following error message: | He then went into apanel used '''MySQL Server Configuration''' to set this new password and received the following error message: | ||
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' | Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' | ||
(using password: YES) in W:\home\admin\www\mqsetup.php on line 46 | (using password: YES) in W:\home\admin\www\mqsetup.php on line 46<br>Error connecting to mysql | ||
'''Not a real problem:''' | '''Not a real problem:''' | ||
Line 43: | Line 42: | ||
The MySQL server requires restarting (from MySQL console) with skip grant table option set as follows: | The MySQL server requires restarting (from MySQL console) with skip grant table option set as follows: | ||
# Start a command prompt: ('''Start''' | # Start a command prompt: ('''Start''' > click on '''Run''' > type '''cmd''' click '''OK''') | ||
# Type following lines into the command prompt: | # Type following lines into the command prompt:<br>'''W:'''<br>'''cd usr\local\mysql\bin'''<br>'''mysqld-opt --skip-grant-tables --user=root''' ''Note: Do not copy and paste you must type it in.'' | ||
# Note the flashing cursor indicating server is running. Minimise this window ('''do not close it'''). | # Note the flashing cursor indicating server is running. Minimise this window ('''do not close it'''). | ||
Dialogue in the command prompt looks similar to this: | Dialogue in the command prompt looks similar to this: | ||
<div style="background:#f0f0f0; border:1px solid #000000; padding-left:10px; width:60%"> | |||
Microsoft Windows XP [Version 5.1.2600] | Microsoft Windows XP [Version 5.1.2600]<br> | ||
(C) Copyright 1985-2001 Microsoft Corp. | (C) Copyright 1985-2001 Microsoft Corp. | ||
C:\Documents and Settings\mpg | C:\Documents and Settings\mpg>'''w:'''<br> | ||
W:\ | W:\>'''cd usr\local\mysql\bin'''<br> | ||
W:\usr\local\mysql\bin | W:\usr\local\mysql\bin>'''mysqld-opt --skip-grant-tables --user=root'''<br> | ||
'''-''' | '''-''' | ||
</div> | |||
=== Set Password and Update grant tables === | === Set Password and Update grant tables === | ||
Line 63: | Line 62: | ||
Start a second command prompt set new password (root) and update grand tables as follows: | Start a second command prompt set new password (root) and update grand tables as follows: | ||
# Start a command prompt: (Start | # Start a command prompt: (Start > click on Run > type cmd click OK) | ||
# Type following lines into the command prompt: | # Type following lines into the command prompt:<br>'''W:'''<br>'''cd usr\local\mysql\bin'''<br>'''mysql'''<br>'''USE mysql;'''<br>'''UPDATE user SET password=password("root") WHERE user="root";'''<br>'''flush privileges;'''<br>'''exit'''<br> | ||
# That's it finished. | # That's it finished. | ||
Dialogue in the command prompt looks similar to this: | Dialogue in the command prompt looks similar to this: | ||
<div style="background:#f0f0f0; border:1px solid #000000; padding-left:10px; width:60%"> | |||
Microsoft Windows XP [Version 5.1.2600] | Microsoft Windows XP [Version 5.1.2600] | ||
(C) Copyright 1985-2001 Microsoft Corp. | (C) Copyright 1985-2001 Microsoft Corp. | ||
C:\Documents and Settings\mpg | C:\Documents and Settings\mpg>'''w:'''<br> | ||
W:\ | W:\>'''cd usr\local\mysql\bin'''<br> | ||
W:\usr\local\mysql\bin | W:\usr\local\mysql\bin>'''mysql'''<br> | ||
Welcome to the MySQL monitor. Commands end with ; or \g. | Welcome to the MySQL monitor. Commands end with ; or \g.<br> | ||
Your MySQL connection id is 1 | Your MySQL connection id is 1<br> | ||
Server version: 5.0.41-community-nt MySQL Community Edition (GPL) | Server version: 5.0.41-community-nt MySQL Community Edition (GPL) | ||
Type 'help;' or '\h' for help. Type '\c' to clear the buffer. | Type 'help;' or '\h' for help. Type '\c' to clear the buffer. | ||
mysql | mysql> '''USE mysql;'''<br> | ||
Database changed | Database changed<br> | ||
mysql | mysql> '''UPDATE user SET password=password("root") WHERE user="root";'''<br> | ||
Query OK, 1 row affected (0.11 sec) | Query OK, 1 row affected (0.11 sec)<br> | ||
Rows matched: 1 Changed: 1 Warnings: 0 | Rows matched: 1 Changed: 1 Warnings: 0 | ||
mysql''' | mysql'''> flush privileges;'''<br> | ||
Query OK, 0 rows affected (0.16 sec) | Query OK, 0 rows affected (0.16 sec) | ||
mysql | mysql> '''exit'''<br> | ||
Bye | Bye | ||
W:\usr\local\mysql\bin | W:\usr\local\mysql\bin> | ||
</div> | |||
=== Kill process and restart === | === Kill process and restart === | ||
Line 104: | Line 103: | ||
# Stop the servers using '''Stop.bat''' close your browser. | # Stop the servers using '''Stop.bat''' close your browser. | ||
# Start the servers using '''Server_Start.bat''' | # Start the servers using '''Server_Start.bat''' | ||
# From apanel run phpMyAdmin. | # From apanel run phpMyAdmin.<br>Under Uniform Server check '''Server version: 5.0.41-community-nt'''<br>Confirms the update was '''successful.''' | ||
=== Conclusion === | === Conclusion === |