Mysql database Management Common commands summary _mysql

Source: Internet
Author: User

MySQL Database management is a crucial part of the database, to understand the management of MySQL database must start from the foundation, only the first knowledge of the database Management command, the actual operation is much easier. Here is the MySQL database management common commands:

  1. Install MySQL using the RPM package and set the TCP 3306 port iptables.
  2. Root password management Sets the password of root user mysqladmin-uroot password ' password '.
  3. Modify root password mysqladmin-uroot-p password ' password '.
  4. Database, table management enters Mysqlmysql-h hostname-uroot-p.
  5. Creating database mysql> Create DB location.
  6. Import data Structure mysql-uroot-p location <./location.sql.
  7. View database mysql> show databases;
  8. Enter a library mysql> use location;
  9. View table information mysql> show tables;
  10. View table structure mysql> desc contact;
  11. Change table name mysql> Rename table contacts to Contact_new.
  12. Delete Library mysql> drop database location.
  13. Delete Table mysql> drop table contact.
  14. The authorization section establishes the user and authorizes mysql> grant all on location.* to gk1020@ ' 10.1.11.71 ' identified by ' gk1020 '.
  15. Suppresses authorization mysql> revoke all on location.* from gk1020@ ' 10.1.11.71 '.
  16. Refresh Permissions mysql> flush privileges.
  17. Action Statement Query mysql> SELECT * from Contacts.
  18. Mysql> Select COUNT (*) from the contact.
  19. Modify mysql> Update Contact set regtime= ' 2008-01-01 00:00:00 ' where id=1.
  20. mysql> Update Contact Set regtime= ' 2008-01-01 00:00:00 ', cid=1 where id=1.
  21. Inserts mysql> INSERT into the contact values (', ' ...)
  22. Mysql> insert into Contacts (id,cid,contact) VALUES (', ' ...)
  23. Deletes the mysql> delete from the contact where id=1.
  24. Export Export Database locationmysqldump-uroot-p location >./location.sql.
  25. Export a table mysqldump-uroot-p--database location--table contact >./contact.sql.
  26. Export the database location data structure mysqldump-d-uroot-p location >./location.sql.
  27. Copy table copy table contact for contact_bakmysql> CREATE TABLE Contact_bak as SELECT * from Contacts.
  28. Copy table contact's structure mysql> CREATE TABLE Contact_bak as SELECT * from Contacts where 1=2.
  29. View the tasks you are performing mysql> show processlist.

Special Note:

Location for library name, contact for table name

Everyone to understand these MySQL database management commonly used commands, and in the actual operation of the application, proficiency, then MySQL database management common commands will be easy.

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.