Common MySQL commands

Source: Internet
Author: User

Start: Net start MySQL;
Enter: mysql-u root-P/MySQL-H localhost-u root-P databasename;
List databases: Show databases;
Select Database: Use databasename;
List tables: show tables;
Show columns from tablename;
Create a database: Source filename.txt;
Matching character: wildcard _ can be used to represent any character, and % represents any string;
Add a field: alter table tabelname add column fieldname datetype;
Add multiple fields: alter table tabelname add column fieldname1 datetype, add columns fieldname2 datetype;
Multi-line command input: note that words cannot be broken; when data is inserted or changed, the field strings cannot be expanded into multiple rows; otherwise, the hard press enter will be stored in the data;
Add an Administrator Account: grant all on *. * to user @ localhost identified by "password ";
After each statement is entered, enter the plus sign ';' At the end, or add '\ G;
Query time: select now ();
Query the current user: Select User ();
Query the database version: Select version ();
Query the currently used database: select 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.