How to modify the previous command when an input error occurs in the MySQL command prompt

How to modify the previous command when an input error occurs in the MySQL command prompt

Current Issues

It is very frustrating to enter multiple lines of commands in the MySQL command prompt and suddenly find that there are errors at the beginning. Most people know that they can cancel the previous input by typing \c and directly return to the "mysql->" prompt. However, if there are too many inputs, it would be a pity to cancel directly, and we need to re-type the command. If we copy directly, there will be a "—>" symbol in front of each copied line, so it will take time to delete these symbols.

Solution process

​ In this case, you can enter \p, and all the content you entered previously will pop up below the command prompt window. Then select the content you want to copy (Ctrl+C), paste it (Ctrl+V) into a text box, and then copy and paste the wrong part after correcting it into the command prompt window to execute the command.

Specific steps

​ That is, enter \p → select the content to be copied (Ctrl+C) → paste it into another text box (where you can paste the changes conveniently) → copy the modified content → enter \c in the command prompt window to end the previous command first → press Ctrl+V to paste the modified content → execute the command.

Solved Case

Example: The spelling of "jion" in the fifth line is wrong and needs to be changed to "join"

After entering multiple lines of commands, it is found that the previous "jion" is misspelled. Press Enter and enter \p

insert image description here

Copy the content you need between the two dotted lines

select
e.ename,d.dname
from
emp e
right jion
dept d
on
e.deptno = d.deptno

Paste it anywhere else and change "jion" to "join".

Execute the command and it runs successfully

insert image description here

By the way, write a quick command for MySQL.

The following table lists the various prompts and briefly describes the status they represent:

Prompt meaning
mysql> Be ready for new orders.
-> Wait for the next line of a multi-line command.
'> Waits for the next line, waiting for the end of a string that begins with a single quote (').
"> Waiting for the next line, waiting for the end of the string that begins with double quotes (""").
/*> Wait for the next line, wait for the end of the comment that starts with /*.

This is the end of this article about how to modify the previous command when an input error occurs in the MySQL command prompt. For more information about how to modify the previous command in the MySQL command prompt, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Create, authorize, delete, and modify passwords of mysql users in the WIN command prompt

<<:  Example of converting webpack images to base64

>>:  This article will help you thoroughly understand the specific use of cgroup in Docker

Recommend

Sample code for CSS dynamic loading bar effect

Using the knowledge of CSS variables, I will dire...

Newbies quickly learn the steps to create website icons

<br />Original URL: http://www.lxdong.com/po...

How to configure MGR single master and multiple slaves in MySQL 8.0.15

1. Introduction MySQL Group Replication (MGR for ...

MySQL and sqlyog installation tutorial with pictures and text

1. MySQL 1.1 MySQL installation mysql-5.5.27-winx...

Detailed steps for installing and configuring MySQL 5.7

1. Download MySQL 1. Log in to the official websi...

Exploring the practical value of the CSS property *-gradient

Let me first introduce an interesting property - ...

React internationalization react-i18next detailed explanation

Introduction react-i18next is a powerful internat...

Solution to MySQLSyntaxErrorException when connecting to MySQL using bitronix

Solution to MySQLSyntaxErrorException when connec...

How to make spaces have the same width in IE and FF?

body{font-size:12px; font-family:"宋体";}...

Solution to the routing highlighting problem of Vue components

Preface Before, I used cache to highlight the rou...

Practice of implementing custom search bar and clearing search events in avue

Table of contents 1. Customize the search bar con...

Example method to view the IP address connected to MySQL

Specific method: First open the command prompt; T...