MySQL Command line tool

Source: Internet
Author: User
Tags mysql command line

shell> MySQL--user=user_name--password=your_password db_name


shell> MySQL--help

shell> mysql-?


Options

--protocol={tcp | sockets | PIPE | MEMORY}


MySQL command

Some commands MySQL can explain themselves. To view these commands, enter Help or \h at the mysql> prompt


The default mysql> can be reconfigured, how to configure which methods?

1. Using Environment variables

Shell> Export mysql_ps1= "(\[email protected]\h) [\d]>"

2. Use the options file my.cnf

[MySQL]

prompt= (\\[email protected]\\h) [\\d]>\\_

Or

prompt= "\\r:\\m:\\s>"

3. Using command-line options

shell> MySQL--prompt= "(\[email protected]\h) [\d]>"

4. Interactive, you can change the prompt interactively using the prompt (or \ r) command.

Mysql>prompt (\[email protected]\h) [\d]>\_

Mysql>prompt

How do I execute an SQL statement from a text file?

1. shell> MySQL db_name < test.sql-p

2. mysql > Source filename

MySQL > \. FileName


Using the--safe-updates option, how do I safely execute the update and DELETE statements?

shell> MySQL--safe-updates--select_limit=500--max_join_size=10000



MySQL Command line tool

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.