MySQL client command line application skills graphic-oriented MySQL management tools are everywhere, but it can really speed up and is not a management tool "graph has its table, maybe none of them are more effective than the command line driven by the MySQL client. However, executing a general query requires a lot of keyboard input, and identifying the database you are currently logged on to and quickly monitoring the performance of the database server will become tedious.
Change client prompt
If you run show tables every time to remind yourself which database you have selected can get a dollar, it is estimated that I have become a millionaire now. In fact, when we switch between IDE, shell, and MySQL client prompts on a regular basis, it is easy to get lost without knowing where we are. To fundamentally eliminate this problem, you can use the following prompt command to change the MySQL prompt:
Mysql> prompt mysql (d)>
After the command is executed, the selected database is displayed at the prompt, as shown below:
Mysql (cmdate)>
In addition, we can easily lose the database server we log on to, not to mention the account in use. To solve this problem, use the u and h options to change the prompt settings:
Mysql> prompt mysql (u @ h)>
The command execution result is as follows:
Mysql (root@www.ctocio.com.cn)>
To permanently save the changes, add the following command to the. my. cnf file:
[Mysql] prompt = mysql d>
The database, user, and host options are only a small part of many optional options. For more information, see the MySQL instructions.
Use shell Alias (Alias) to execute frequently-used MySQL commands
Assume that your new web application is gradually entering the application stage, and new users are registered every hour. Just like IPO, you and your colleagues need to pay attention to the number of registered users. However, to execute a simple counting query, you need to constantly log on to and exit MySQL, which is obviously not very cost-effective. If you log on to the server, you can create a shell alias to log on to the MySQL server, select the appropriate database, and execute the count command throughout the process: