mysql metadata and some common commands

The so-called mysql metadata are some initial things, such as a list of databases, data tables list the number of rows affected by the query, and so on, there is some information about the mysql server, such as version information.

  • select version (): Gets the version information mysql server
  • select database (): Get the current database name
  • show status: view server status information
  • show variables: View the server configuration variables
  • desc table_name: see table fields and types of information
  • show create table table_name \ G: view the construction of the table statement \ G formatted output
  • use db_name: switch databases
  • show databases: Lists all databases
  • show tables: displays all the current database table
  • show columns from table_name: Display field information table, etc., and as desc table_name
  • show index from table_name: index information displays detailed data table, comprising PRIMARY KEY (primary key)
  • Status like Table Show [ from db_name][like 'pattern']/ G **: This command output performance and statistical information Mysql database management system, for example: show table status from goodsinfo \ G ;
  • create database db_name: Create a database, when sufficient permissions when using this
  • drop database db_name: delete the database
    using the mysqladmin mysql when not entering the terminal to create and delete database
  • mysqladmin -u root -p create db_name: create a database using the mysqladmin command
  • mysqladmin -u root -p drop db_name: Delete the database

Guess you like

Origin www.cnblogs.com/jasonboren/p/11362070.html