MySQL Basic Operations Command

Source: Internet
Author: User

Start/Stop MySQL Service under MacOS

Local connection MySQL Service, user name: root, Password: abc123

$ mysql-hlocalhost-uroot-pabc123

Show Database list

mysql> show databases;

Displaying data tables in a library

mysql> use MySQL;

Mysql> Show tables;

Building libraries and deleting libraries

mysql> CREATE DATABASE BCU;

mysql> drop Database BCU;

Establishment and deletion of tables

mysql> use BCU;

Mysql> CREATE TABLE Finance (name varchar (+), amount int);

mysql> drop table Finance;

Show the structure of a data table

Mysql> describe finance;

Emptying records in a table

mysql> Delete from finance;

Show records in a table

Mysql> select * from Finance;

Add a record to the table

mysql> INSERT INTO finance values ("Tanyun", 100);

Updating data in a table

Mysql> Update finance set amount=150 where name= ' Tanyun ';

Delete data from a table

mysql> Delete from finance where name = ' Tanyun ';

MySQL Basic Operations Command

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.