Basic operation of MySQL database under Linux

Source: Internet
Author: User

To establish a database:

mysql> CREATE DATABASE test; Create a database named "Test"

To create a database table:

Mysql> CREATE TABLE Test

(name char (+) NOT NULL,

-passwd char (16)

); Create a table named "Test" with two fields, a field named "Name", type char, size 16, non-null, another field named "Passwd", and a char type with a size of 16, which can be empty.

To find elements in a table:

Mysql> select * from test; Finds all the elements in the "test" table.

To insert an element into a table:

mysql> INSERT into test values (' ASD ', ' 123 '); Insert this data into the "test" table with the name "ASD" and passwd as "123".

To delete an element in a table:

mysql> Delete from test where name= ' ÁSD '; Delete the data in the "test" table with the name "ASD".

To modify an element in a table:

mysql> Update test set passwd= "111" where name= "ASD"//the "test" table, the password for "ASD" is changed to "111".

To modify the database password:

Mysql> set Password=password (' 123456 '); Set the database password to 123465.

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.