Useful Mysql
UNIX_TIMESTAMP(), UNIX_TIMESTAMP( 'yyyy-mm-dd' ) get a unixtimestamp for a given mysql date, defaults to now
FROM_UNIXTIME( 1046386800 ) get a mysql date from a unix timestamp
REPLACE INTO tries to do an INSERT, if key violation, performs UPDATE
show processlist prints a list of everything that the mysql host is doing
optimize table [table name] should do after massive deletes
bin/safe_mysql & starts mysql server
bin/mysqladmin -uroot shutdown stops mysql server
bin/safe_mysql --log & restarts mysql server
mysql -hhostname -uroot -ppassword databasename accesses mysql from command line
LOCK TABLES tablename1, tablename2 WRITE lock tables to writing
UNLOCK TABLES removes all locks
isamchk [-s] [-r] [-o] checks table, s=fastest, r=rebuilds slowly, o=rebuilds very slowly
/usr/local/bin/isamchk -0 *.ISM && safe_mysql & isamchk example
cat filename.sql | mysql -hhostname -uuser -f -p database runs any valid sql commands in filename, f=warns on errors but doesn't stop
mysqladmin -hhostname -uuser -p variables shows server variables from command line
SHOW VARIABLES shows server variables from within client
stop the server, from prompt: safe_mysql --set-variable max_connections=80 &, start server changing server variables
mysqldump database -d d=no data creation rows
stop mysql, restart with --skip-grant-tables disables password checking
edit /etc/hosts, add first part of hostname to end of line that begins 127.0.0.1 fixes Please configure th 'hostname' error
$dbh->{PrintError} = 0 Turn off printing of errors for the database handle.