Common mysql commands and common mysql system commands

Source: Internet
Author: User
Tags mysql commands

Common mysql commands and common mysql system commands

Recently, some mysql commands were often used during my internship, so I made some preparations:

Solve the character garbled problem: display Chinese characters rather than garbled characters: set names utf8;

Change New password: update user set PASSWORD = password ('new password') where user = 'username ';

Update permission: flush privileges;

Add a new user: grant select on database. * to username @ login host identified by 'Password ';

Delete A user: delect from user where user = 'username' and host = 'localhost ';

Delete database: drop database dbname;

Drop table tablename;

View the currently used database: select () database;

Get the table structure: desc tablename;

Show columns from tablename;

Decribe tablename;

Insert data: insert into tablename values (),();

Query the data of the first few rows: select * from tablename order by id limit;

Change table name: rename table original table name to new table name;

Data Import: source * SQL (direct path );

Data export: mysqldump-u root-p Database Name> exported file name (the file name can be directly stored in the local directory)

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.