Several methods to execute sql files under mysql command line

Several methods to execute sql files under mysql command line

To achieve the goal: Import the tsinfo180516.sql file into the database demo1 through the command line.

Rendering

The first method: When the MySQL database is not connected

Execute the sql file in the mysql command line

Run --cmd

C:\Users\lenovo>mysql -u account -p password -D database name < sql file absolute path

C:\Users\lenovo>mysql -uroot -proot -Ddemo1<C:\Users\lenovo\Desktop\tsinfo180516\tsinfo180516.sql

The second method: When the database is already connected, the command prompt is mysql>.

Enter the password to connect to the database

Practical record of importing SQL files using MySQL source command

Enter the full path of the source script or \. full path of the script

For example: source <C:\Users\lenovo\Desktop\tsinfo180516\tsinfo180516.sql

Or \. <C:\Users\lenovo\Desktop\tsinfo180516\tsinfo180516.sql

This concludes this article about several methods of executing SQL files under the MySQL command line. For more information about executing SQL files under the MySQL command line, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • mysql command line script execution example
  • Summary of several ways to execute SQL in the MySQL command line

<<:  Tutorial on installing nginx in Linux environment

>>:  Pure CSS to solve the ceiling and bottom suction in H5 layout implementation steps

Recommend

Web Design Tutorial (2): On Imitation and Plagiarism

<br />In the previous article, I introduced ...

Implementation of mysql data type conversion

1. Problem There is a table as shown below, we ne...

MySQL uses variables to implement various sorting

Core code -- Below I will demonstrate the impleme...

mysql trigger creation and usage examples

Table of contents What is a trigger Create a trig...

Detailed analysis of SQL execution steps

Detailed analysis of SQL execution steps Let'...

Detailed Tutorial on Using xargs Command on Linux

Hello everyone, I am Liang Xu. When using Linux, ...

Summary of the Differences between SQL and NoSQL

Main differences: 1. Type SQL databases are prima...

Vue3 implements Message component example

Table of contents Component Design Defining the f...

Installation tutorial of mysql8.0rpm on centos7

First, download the diagram 1. First uninstall th...

How to add abort function to promise in JS

Table of contents Overview Promise Race Method Re...

Detailed explanation of HTML tables

Function: data display, table application scenari...

Detailed explanation of the execution order of JavaScript Alert function

Table of contents question analyze solve Replace ...