Differences between version 5 and revision by previous author of MySQLNotes.
Other diffs: Previous Major Revision, Previous Revision, or view the Annotated Edit History
Newer page: | version 5 | Last edited on Sunday, April 11, 2004 5:28:04 pm | by AristotlePagaltzis | Revert |
Older page: | version 3 | Last edited on Sunday, April 11, 2004 12:12:03 pm | by MichaelBordignon | Revert |
@@ -1,45 +1,36 @@
-!
!! Resetting a forgotten [MySQL] ''root'' password
+!! Resetting a forgotten [MySQL] ''root'' password
Instructions according to [MySQL Documentation|http://www.mysql.com/documentation/mysql/bychapter/manual_Problems.html#Resetting_permissions]
-! "Disable"
the current passwords
+You first need to make [MySQL] forget
the current credentials. This can only be done by the SuperUser or the user mysqld runs as, because the daemon must be stopped, which requires sending it a kill(1) signal (don't use __-9__!!). The [PID] is found in the __.pid__ file normally found in the [MySQL] database directory:
-If you are the SuperUser or the user mysqld runs as, take it down by sending it a kill(1) (don't use
__-9
__!!). Its PID is stored in a __.pid__ normally found in the [MySQL] database directory:
- #
kill `cat /mysql-data-directory
/hostname.pid`
+
__#
__ kill `cat /path/to
/mysql/datadirectory/''
hostname''
.pid`
-Now restart __mysqld__ with the __--skip-grant-tables__ option and
set a new password. There are two alternatives
:
+Now you can
restart __mysqld__ with the __--skip-grant-tables__ option so that you can
set a new password. There are two alternative ways to do so
: either the __mysqladmin__ tool, by way of
-! Using
mysqladmin
+ __$__
mysqladmin -u root password 'mynewpassword'
+ __$__ mysqladmin -h hostname flush-privileges
-That's as simple as
+or using the __mysql__ client:
- mysqladmin
-u root password
'mynewpassword'
- mysqladmin -h hostname flush-privileges
+ __$__ mysql
-u root mysql
+ __mysql>__ UPDATE user SET Password=PASSWORD(
'mynewpassword') WHERE User='root' ;
+ __mysql>__ FLUSH PRIVILEGES ;
-! Using
the mysql client
+You should now be able to connect using
the new password. __''Test this!''__
-Connect to the mysqld server with
:
+One final step remains
: stop __mysqld__ and restart it normally.
- mysql -u root mysql
+!! Clearing Unwanted Binary Log Files
-Issue the following commands in the mysql client:
-
- mysql> UPDATE user SET Password=PASSWORD('mynewpassword') WHERE User='root';
- mysql> FLUSH PRIVILEGES;
-
-! Done.
-
-You should now be able to connect using the new password. You can now stop mysqld and restart it normally.
-
-!!! Clearing Unwanted Binary Log Files
mysql in some configurations can log all database activity to a binary log file (usually in /var/lib/mysql). If you have a busy site this can grow quite large. The recommended management solution in the mysql manual is to remove binary log files that you no longer want. They suggest removing files that are older than 3 days. To remove all binary log files you can use the following command
- RESET MASTER;
+ RESET MASTER ;
-!
!! What to do if the table handler is returning error 28
+!! What to do if the table handler is returning error 28
-If you receive
the following from
mysql_error()
+If the __
mysql_error()__ [PHP] function returns
Got error 28 from table handler
-this means your disk is full
. Probably /tmp. Go clear it out.
+this means your disk runneth over
. Probably __
/tmp__
. Go clear it out.