Thursday, September 13, 2007

common but not so commonly used "mysql" commands

I always forget the exact syntax or parameters of these commands...

Grant Privileges:
mysql> GRANT ALL PRIVILEGES ON db_name.* TO username@host -> IDENTIFIED BY 'password' WITH GRANT OPTION;

Change root password:
first time: $ mysqladmin -u root password NEWPASSWORD
change: $ mysqladmin -u root -p oldpassword newpass
bypass: c:\> mysqld-nt --skip-grant-tables

Backup:
fullbackup of db:
$ mysqldump --tab=/path/to/some/dir --opt db_name or
$ mysqlhotcopy db_name /path/to/some/dir

No comments: