Mysql basic, mysql

Source: Internet
Author: User

Mysql basic, mysql
Mysql-u root-pEnter the password to enter the databaseShow database;Query Current DatabaseUse databasenameSwitch to a databaseShow tables;List the tables of the current databaseDesc tbalenameList table fieldsSelect user ()+ ---------------- +| User () |+ ---------------- +| Root @ localhost |+ ---------------- +View the current userSelect database () + ------------ +| Database () |+ ------------ +| Ylg |+ ------------ +View the database currently usedCreate database db1;Create a database named db1Create table t1 ('id' int (4), 'name' char (40 ))Create Table t1 and enclose the fields in backquotes!Show statusView the current MYsql statusShow variablesView Mysql ParametersShow variables like 'max _ connect %'View a parameter. % is similar to omnipotent match.Set global max_connect_errors = 1000;Modify the parameter. The global parameter specifies the parameter name to be modified. set global can be modified temporarily and will expire after restart.Show processlistView the current server QueueGrant all on *. * to user1 identified by 'root'Create and authorize user1 and set the password.Insert into t1 values (1, 'abc ');Insert data into a tableUpdate t1 set name = 'aaa' where id = 1;Modify Table DataTruncate table t1Clear table data, but not deleteDrop table t1;Delete tableDrop database db1;Delete Database 

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.