Experience with MySQL (10) Common commands

Source: Internet
Author: User
Tags command line execution flush mysql mysql free socket table name mysql view

MySQL View status

./mysqladmin-uroot-popen Extended-status

Then grep for Shell programming

Direct execution of EXTERNAL commands

./mysql-uroot-e "Show Master Status \g"

Parsing SQL statements

Explain <SQL>;

Explain partitions <SQL>;

View table Structure

DESC table name;

View the structure of creating a table

Show create table name;

View variables (configuration file)

Show variables like '%binlog_format% ';

View status (Run time)

Show status like '%conn% ';

MySQL Free login Execution command

Mysql-uroot-e "show slave status\g;"

MySQL Specifies a profile login

./bin/mysql--defaults-file=/root/mysql/my.cnf-uroot

Lock table

FLUSH TABLES with READ LOCK;

Unlock

UNLOCK TABLES;

MySQL debugging syntax

After the error, execute show warnings;

can see more information

Open root remote access, generally don't do this

Grant all privileges in *.* to ' root ' @ '% ' with GRANT OPTION;

Garbled

Command line login MySQL, view code

Show variables like '%character% '

Creating a Database

Create Database my_test;

Authorized

Grant all privileges on my_test.* to my_test@ '% ' identified by ' my_test_123 ';

Modify Root Password

Update Mysql.user Set Password=password (' Open ') where user= ' root ';

Flush privileges;

Backing up data (where you can manually specify the socket parameter--socket=/application/search/mysql/mysql/tmp/mysql.sock)

./mysqldump-uroot my_test-v >/data0/search/my_test.sql

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.