Loading...
 

MySQL Commands

MySQL CLI

General

RESET MASTER; – clears all binary logs
PURGE {MASTER|BINARY} LOGS TO binlog_name;
PURGE {MASTER|BINARY} LOGS BEFORE date; - This command is used to delete all binary logs strictly prior to the specified binlog or date.
show dbname status\G;
show full processlist; - gives connetion info to database
show binary logs;
create database databasename; create a database
show status like ‘Aborted_Connects’;
show status like ‘Connections’;

granting user access

grant usage on dbname.tablename to ‘user’@‘hostnameidentified by ‘passwd’;
or
grant all privileges on databasename.* to ‘username’@‘hostname’;
flush privileges;

Host System CLI

mysql -u username -p
mysql -s stops the MySQL CLI from outputting the results in a table
mysql_dump has a switch to not include data
mysqlbinlog --database=DBname --user=username --password=passwd logfile
mysql -uusername -ppassword -S /tmp/mysql-master.sock - connect to a specific socket
mysqladmin -uusername status -p
mysql -uusername __-p < backup.sql – restore from a mysqldump file