Summary of Common Commands for Getting Started with MySQL Database Basics

Summary of Common Commands for Getting Started with MySQL Database Basics

This article uses examples to describe the commonly used commands for getting started with the basics of MySQL database. Share with you for your reference, the details are as follows:

Continued from the previous article: Practical process of master-slave synchronization of MySQL database

Introduction to mysql commands

mysql is a database management command

Use mysql --help to view related parameters and usage instructions

mysql --help

      #mysql database management command Usage: mysql [OPTIONS] [database]

      #Syntax format --help #View help document --auto-rehash

      #Auto-completion function -A, --no-auto-rehash

      #No need for automatic completion -B, --batch

    #Do not use history file, disable interaction --character-sets-dir=name

     #Character set installation directory -C, --compress

 #Compression when the client and server transmit information-#--debug[=#]

     #Call function -D, --database=name

     #Use database --default-character-set=name

     #Set the default character set -e, --execute=name

     #Execute sql statement -E, --vertical

    #Vertical print output information -f, --force

    #Skip the error and execute the following command -G, --named-commands

    #Print the query results by column -i, --ignore-spaces

    #Ignore spaces -h, --host=name

     #Set the address and IP of the connection server

--line-numbers

    #Show the line number with error -L, --skip-line-numbers

    #Ignore the line number with error -n, --unbuffered

    #Refresh the cache after each SQL execution --column-names

    #Display column information when querying -N, --skip-column-names

    #Do not display column information -p, --password[=name]

    #Enter password information -P, --port=#

    #Set port information --prompt=name

    #Set mysql prompt --protocol=name

    #Set the usage protocol -s, --silent

   # Output line by line, tab interval -S, --socket=name

   #Connect to the server using socket file -t, --table

   #Output in table format -u, --user=name

   #Username to connect to the server -v, --verbose

   #Print the command executed by sql -V, --version

   #Output version information -w, --wait

   #Time to wait for the server to restart after shutdown --connect-timeout=#

   #Time to wait before connecting --max-allowed-packet=#

#The maximum length of packets sent and received by the server --show-warnings

  #Display warning message

Introduction to mysqldump command

mysqldump data backup command (logical backup)

This is one of the most frequently used commands in daily life. It is also a commonly used database backup command in small and medium-sized enterprises or when the amount of data is not large. It is very practical.

mysqldump --help

#mysql database backup command (logical backup)

Usage: mysqldump [OPTIONS] database [tables]

mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]

mysqldump [OPTIONS] --all-databases [OPTIONS]

     #Backup command format --print-defaults

   #Print the default program parameter list --no-defaults

  #Do not output default option parameters --defaults-file=#

  #Set the specified option parameter file -A, --all-databases

  #All databases --add-drop-database

#Add the drop database statement before creating data --add-locks

#Add lock tables before exporting each table and unlock tables afterwards

--character-sets-dir

  #Character set file directory --compact

  #Export less output information -B --databases

#Specify database --debug-info

# Output debugging information and exit --default-character-set

#Set the default character set, the default is utf8

--dump-slave

#Append the main binlog location and file name to the exported data file --events,-E

  #Backup event information --flush-logs,-F

  #Refresh log after backup -p, --password[=name]

  #Connect to database password -P, --port=#

  #Set port information -S, --socket=name

  #Connect to the server using the socket file -V, --version

  #Output version information -u, --user=name

  #Username to connect to the server

Introduction to the mysqlbinlog command

mysqlbinlog is a command used to view binlog binary log file information. It is also one of the frequently used commands in daily life and is usually used when restoring database data.

mysqlbinlog --help

#View the information recorded in mysql binlog log file Usage: mysqlbinlog [options] log-files

   #Syntax format --character-sets-dir=name

    #Specify the character set file directory -d, --database=name

    #View the log file of the specified database -h, --host=name

    #View the log file on the specified host --start-position=953

      #Starting pos point --stop-position=1437

      #End pos point --start-datetime=

      #Starting time point --stop-datetime=

      #End time point --database=

      #Specify to restore only the database

Readers who are interested in more MySQL-related content can check out the following topics on this site: "MySQL query skills", "MySQL common functions summary", "MySQL log operation skills", "MySQL transaction operation skills summary", "MySQL stored procedure skills" and "MySQL database lock related skills summary"

I hope this article will be helpful to everyone's MySQL database design.

You may also be interested in:
  • Summary of MySQL basic common commands
  • MySQL Database Basics: A Summary of Basic Commands
  • MySQL database basic commands (collection)
  • Getting started with MySQL Basics Learn MySQL commands easily
  • Summary of basic commands for MySQL learning

<<:  Learn the operating mechanism of jsBridge in one article

>>:  Vue implements adding watermark effect to the page

Recommend

How to clean up data in MySQL online database

Table of contents 01 Scenario Analysis 02 Operati...

Detailed explanation of Mysql transaction processing

1. MySQL transaction concept MySQL transactions a...

The new version of Chrome browser settings allows cross-domain implementation

Preface Currently, the front-end solves cross-dom...

Detailed explanation of asynchronous iterators in nodejs

Table of contents Preface What are asynchronous i...

Summary of Docker Consul container service updates and issues found

Table of contents 1. Container service update and...

Detailed tutorial on installing Docker on CentOS 8

1. Previous versions yum remove docker docker-cli...

How to build a multi-node Elastic stack cluster on RHEL8 /CentOS8

Elastic stack, commonly known as ELK stack, is a ...

Vue.js style layout Flutter business development common skills

Correspondence between flutter and css in shadow ...

How to use gdb to debug core files in Linux

1.core file When a Segmentation fault (core dumpe...

Learn more about the most commonly used JavaScript events

Table of contents JavaScript events: Commonly use...

Detailed explanation of JSONObject usage

JSONObject is just a data structure, which can be...

Optimized record of using IN data volume in Mysql

The MySQL version number is 5.7.28. Table A has 3...