TestingDocs.com
    Software Testing website
    • Automation
      • Selenium
      • JBehave Framework
    • Tutorials
      • MySQL Tutorials
      • Testlink
      • Maven
      • Git
    • IDEs
      • IntelliJ IDEA
      • Eclipse
    • Flowcharts
      • Flowgorithm
      • Raptor
    • About

    MySQL

    MySQL Import using SQL file

    Overview

    In this tutorial, we will learn MySQL import using SQL statement file(*.sql file extension). SQL statement file is a script file that contains SQL commands and queries that can be executed at the MySQL command shell.

    New data can be imported into a database using a SQL statement file that contains the information needed to create tables, insert data, etc.

    For example, to import the world database SQL file, we could use the following statement:

    \> mysql -u root-p world < world.sql

    This will prompt for the root password.

    SOURCE command

    We can also use the SOURCE command from the mysql client’s interactive shell. MySQL shell-level client commands do not require a semi-colon(;) at the end of the statement.

    mysql> SOURCE /path/to/file

    Alternatively, the SOURCE can be replaced with \.

    mysql> \. <path_to_SQL_filename>

    MySQL Source Command

    For example, on the Windows operating system import the database from the world.sql file located at C:/world.sql location.

    SOURCE C:/files/world.sql

    The SQL statements in the script are sent to the MySQL server and executed. The server sends the message for each statement. The command-line MySQL client echoes the server messages to the computer screen.

    We can also import from a data file using the LOAD DATA INFILE statement.

    MySQLImport Utility

    https://www.testingdocs.com/import-data-with-mysqlimport-utility/

    —

    MySQL Tutorials

    MySQL Tutorials on this website:

    https://www.testingdocs.com/mysql-tutorials-for-beginners/

    For more information on MySQL Database:

    https://www.mysql.com/

    Related Posts

    Stellar Converter for Database Tool

    MySQL /

    Stellar Converter for Database

    Stellar MySQL Log Analyzer

    MySQL /

    Stellar Log Analyzer for MySQL

    Stellar Repair for MySQL

    MySQL /

    Stellar Repair for MySQL

    MySQL /

    How to secure your SQL Database: Tips and Tricks

    Stellar Converter for Database

    MySQL /

    Database Converter Tools

    ‹ MySQL DROP TABLE Statement› MySQL SELECT DISTINCT clause

    Recent Posts

    • ChatGPT Plans Free and PlusChatGPT Subscription Plans
    • Stellar Converter for Database ToolStellar Converter for Database
    • Stellar MySQL Log AnalyzerStellar Log Analyzer for MySQL
    • Stellar Repair for MySQLStellar Repair for MySQL
    • ChatGPT IntroductionChatGPT Capabilities
    • How to secure your SQL Database: Tips and Tricks
    • ChatGPT4 Conversational AI FeaturesChatGPT4 Conversational AI Features
    • Trends in Software EngineeringShaping the Future of Development: Exploring Key Trends in Software Engineering
    • Java PerformanceImproving Java Performance with Multithreading
    • QDrant Vector DatabaseOpen-source Vector Databases
    • Difference between PHP and JavaScript?
    • Bing AI Browser Web ContentBing Conversation Styles
    • ChatGPT PreviewChatGPT Introduction
    • Open Source AI Frameworks TensorFlowOpen Source AI Frameworks
    • Artificial Intelligence Tools

    Back to Top

    Links

    • Contact
    • Privacy Policy
    • Cookie Policy

    www.TestingDocs.com