You are here
Mysql Important commands
Log mysql commands and output in a text file
mysql --tee=file_name.txt -u user -ppassword database_name
Log mysql output in a html file
mysql --html --tee=file_name.html -u root -ppassword database_name ;
Start mysql without normal introduction use -s switch s for silent.
mysql -u root -ppassword -s
Start mysql or change datables quick with -A switch.
mysql -u user -ppassword -A database_name;
>> operator will add at the end of the line.
echo not_to_be_tracked.file >> .gitignore
Execute a statement use -e or --execute=command-line switch.
mysql -u root -ppassword -e "select * from users" database_name ;
Batch mode to output in tab delimited fields.
mysql -B -u root -ppassword database_name
Create a user in mysql
create user 'dk'@'localhost' identified by 'password';
Grant all privileges
grant all privileges on *.* to 'dk'@'localhost' with grant option;
grant usage on *.* to dk@localhost identified by 'password';
Check for running processes
mysqladmin -ppassword processlist;
Kill some process
mysqladmin -ppassword kill 10;
Get the structure of table
SHOW CREATE TABLE