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

Detailed explanation of jQuery method attributes

Table of contents 1. Introduction to jQuery 2. jQ...

Example of MySQL slow query

Introduction By enabling the slow query log, MySQ...

Sample code for automatic web page refresh and automatic jump

Automatic web page refresh: Add the following code...

Centering the Form in HTML

I once encountered an assignment where I was give...

iframe parameters with instructions and examples

<iframe src=”test.jsp” width=”100″ height=”50″...

Steps to run ASP.NET Core in Docker container

There are too much knowledge to learn recently, a...

Web Design Tutorial (4): About Materials and Expressions

<br />Previous Web Design Tutorial: Web Desi...

Nginx rush purchase current limiting configuration implementation analysis

Due to business needs, there are often rush purch...

Vue encapsulates the public function method of exporting Excel data

vue+element UI encapsulates a public function to ...

Explanation of the working mechanism of namenode and secondarynamenode in Hadoop

1) Process 2) FSImage and Edits Nodenode is the b...

Solution to the Chinese garbled characters problem in MySQL under Ubuntu

Find the problem I have been learning Django rece...

Summary of MySQL foreign key constraints and table relationships

Table of contents Foreign Key How to determine ta...

Use pure CSS to disable the a tag in HTML without JavaScript

In fact, this problem has already popped up when I...

Basic knowledge points of mysql worm replication

Worms replicate, as the name implies, by themselv...

About browser compatibility issues encountered and solutions (recommended)

Preface: Last Sunday, a senior asked me to help m...