Tuesday, January 8, 2013

Useful MySQL command line Shortcuts and commands

In our daily MySQL Process we need to do some task repeatedly. Below are some useful  command line shortcut to work with MySQL. 

\? = help 

\c = clear command, It Will cancel last executed command. 

\C = switch to another charset, It will help if you want to use another character set. Make sure you are choosing correct charcter Set.

\d = set delimiter (use something else after a statement instead of ;), It will help whenever you are  creating function and procedure.

\g = send command to server , it will help to execute command , Will work as delimiter

\G = send command to server, Will work as delimiter , It will show resultset in grid format.

With \g and \G you can generate "vertical" output with each column value on a separate line. This makes large outputs far more readable !

\h = help, to See the help content and commands

\p = print current command

\q = quit MySQL
\r = reconnect (or see which database you're in)

\R = change your mysql prompt (personalize your prompt, which can be funny)

\s = show status (which can be very informative)

\t = don't write to into outfile
\T = write into outfile
\u = use database

\w = don't show warnings after every statement
\W = show warnings after every statement
\# = rebuild completion hash
\. = execute an SQL scriptfile
select database()= To know current database.

Enjoy Short cuts :)


Abhijit said...

Good collection dude. Was helpful in daily activities.

Anonymous said...
This comment has been removed by a blog administrator.
Anonymous said...

electronic cigarette reviews, electronic cigarettes, electronic cigarette starter kit, electronic cigarette, ecig, vapor cigarette