MySQL Common commands

Source: Internet
Author: User
Tags rehash

MySQL Command introduction

MySQL is a database administration command

Use MySQL--help to view relevant parameters and instructions

MySQL--help

#mysql Database Administration Commands

Usage:mysql [OPTIONS] [Database]

            # Syntax Format

--help # View Help documentation

--auto-rehash

# Auto-complete function

-A,--no-auto-rehash

           # No auto-completion required

-B,--batch

# disable interaction without using a history file

--character-sets-dir=name

# Character Set installation directory

-C,--compress

# compression when the client and the server pass information

-#--debug[=#]

# Invoke function

-D,--database=name

# Working with Databases

--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

# query results are printed by column

-I.,--ignore-spaces

# Ignore spaces

-H,--host=name

# set the address and IP of the connection server

--line-numbers

        # Displays the line number with the error

-L,--skip-line-numbers

        # Ignore line numbers that have errors

-N,--unbuffered

# flush 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=#

# Setting Port information

--prompt=name

# set up a MySQL prompt

--protocol=name

 # set up a usage protocol

-S,--silent

# One line of output, tab interval

-S,--socket=name

# connect to the server using the socket file

-T,--table

 # output in tabular format

-U,--user=name

# user name of the connection server

-V,--verbose

# print commands executed by SQL

-V,--version

# Output Version Information

-W,--wait

# the time to wait for a restart after the server has been down

--connect-timeout=#

# the time to wait before connecting

--max-allowed-packet=#

# maximum length of the server to send and receive packets

--show-warnings

# displaying warning messages

mysqldump Command Introduction

mysqldump Data Backup command (logical backup)

One of the most frequently used commands, is also a small and medium-sized enterprise or data volume is not a common use of database backup commands, 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=#

# sets the specified option parameter file

-A,--all-databases

# all Databases

--add-drop-database

# Add drop DATABASE statements before creating data

--add-locks

# add lock tables before each table is exported and then unlock tables

--character-sets-dir

   # Character Set file directory

--compact

# Export less output information

-B--databases

# Specify the database

--debug-info

# output debug information and exit

--default-character-set

# sets the default character set, which defaults to UTF8

--dump-slave

# Append the primary 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 Database Password

-P,--port=#

   # Setting Port information

-S,--socket=name

   # connect to the server using the socket file

-V,--version

    # Output Version Information

-U,--user=name

# user name of the connection server

Mysqlbinlog Command Introduction

Mysqlbinlog is a command used to view binlog binary log file information, and is one of the most frequently used commands for daily use, usually when recovering database data.

Mysqlbinlog--help

# view MySQL's binlog log file records for information

Usage:mysqlbinlog [Options] Log-files

# syntax format

--character-sets-dir=name

  # Specify the character set file directory

-D,--database=name

 # View log files for a specified database

-H,--host=name

# View log files on a specified host

--start-position=953

   # starting point of POS

--stop-position=1437

     # End POS Point

--start-datetime=

    # starting point of time

--stop-datetime=

   # End Time Point

--database=

 # specify that only the database is restored

MySQL Common commands

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.