Penguin

Differences between version 6 and revision by previous author of MySQLNotes.

Other diffs: Previous Major Revision, Previous Revision, or view the Annotated Edit History

Newer page: version 6 Last edited on Sunday, April 11, 2004 5:33:30 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
+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:  
  
-! "Disable" the current passwords  
+ __#__ kill `cat /path/to/mysql/datadirectory/''hostname''.pid`  
  
-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`  
+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  
  
-Now restart __mysqld __ with the __--skip-grant-tables__ option and set a new password. There are two alternatives:  
+ __$ __ mysqladmin -u root password 'mynewpassword'  
+ __$__ mysqladmin -h hostname flush -privileges  
  
-! Using mysqladmin  
+or using the __mysql__ client:  
  
-That 's as simple as  
+ __$__ mysql -u root mysql  
+ __mysql>__ UPDATE user SET Password=PASSWORD( 'mynewpassword') WHERE User='root' ;  
+ __mysql>__ FLUSH PRIVILEGES ;  
  
- mysqladmin -u root password 'mynewpassword '  
- mysqladmin -h hostname flush-privileges  
+You should now be able to connect using the new password. __ ''Test this!''__  
  
-! Using the mysql client  
+One final step remains: stop __mysqld__ and restart it normally.  
  
-Connect to the mysqld server with
+See also: [MySQL Manual: A.4.2 How to reset the Root Password | http ://dev.mysql.com/doc/mysql/en/Resetting_permissions.html]  
  
- 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 
+!! [PHP] says the table handler is returning error 28 
  
-If you receive the following from mysql_error() 
+If the [ mysql_error() | http://www.php.net/manual/en/function.mysql-error.php] [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.