GnuSys Notes : MysqlHacks

HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register
Please follow the steps below to recover a lost MySQL root password:

1.Stop mysqld and restart it with the --skip-grant-tables --user=root options (Windows users omit the --user=root portion).
2.Connect to the mysqld server with this command:

shell> mysql -u root

3.Issue the following statements in the mysql client:

mysql> UPDATE mysql.user SET Password=PASSWORD('newpwd')
-> WHERE User='root';
mysql> FLUSH PRIVILEGES;

Replace “newpwd” with the actual root password that you want to use.
4.You should be able to connect using the new password.


Install Mysql from source:
http://dev.mysql.com/doc/refman/4.1/en/installing-binary.html

Mysql documentation quick link
http://dev.mysql.com/doc/



MySQL has a feature that allows you to log slow running queries to a file. To enable you just need to add some lines to your my.cnf file, and restart. Add the following:

log-slow-queries = /var/log/mysql/mysql-slow.log
long_query_time = 1

The above will log queries taking longer than one second to the specified log file.




Mysql Example Commands Reference:

show variables;
show status;
show databases;
use <databasename> ;
show tables;
describe <tablename>;


Delete all data from a table:
http://www.electrictoolbox.com/article/mysql/delete-all-data-mysql/

There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.3
Page was generated in 0.8839 seconds