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

    MySQL

    Command-Line MySQL Client

    Overview

    In this tutorial, we will learn about command-Line MySQL client. We can use the command-line client to connect to the MySQL Server and execute SQL queries.

    We will learn how to connect to MySQL server using the command-line client.

    MySQL Client

    On Windows open the command prompt and type the MySQL command.

    Instructions to start the MySQL client can be found here:

    https://www.testingdocs.com/start-mysql-client-on-windows-11/

    Get Help

    We can get help by using the help command:

    /> mysql –help

    Command-Line Options

    Some of the command-line options are as follows:

    Flag/Option Parameter Description
    -h hostname hostname or the IP address of the host machine where the MySQL Server is running or trying to connect.
    -u username Specify the username of the user.
    -p password Specify the password of the user.
    < script file .sql file to execute commands in the file.
    > output file Save the output to the file.

    Examples

    Let’s see some examples and usage of the mysql command.

    In this example, we will connect to the local MySQL Server as a root user. We can omit the -h hostname flag if the MySQL Server and the MySQL client are running on the same machine.

    /> mysql -u root -p

    C:\Users\testingdocs>mysql -u root -p
    Enter password: **********
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 9
    Server version: 8.0.27 MySQL Community Server – GPL

    Copyright (c) 2000, 2021, Oracle and/or its affiliates.

    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.

    Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

    MySQL Command-line Client

    Successful connection displays the Welcome message,Copyright information, help information and the mysql> prompt.

    In the next example, we will connect to MySQL Server running on remote demo.testingdocs.com as john user and execute commands in createTables.sql SQL statement file.

    /> mysql -h demo.testingdocs.com -u john < createTables.sql -p

    —

    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

    ‹ Start MySQL Client on Windows 11› New MySQL Connection in Workbench

    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