Simple operation of MySQL and MARIADB

Source: Internet
Author: User
Tags create database

MySQL simple operation one, view the database show DATABASES; for example: MariaDB [(None)]> show databases;+--------------------+| Database |+--------------------+| Information_schema | | MySQL | | Performance_schema | | Test |+--------------------+4 rows in Set (0.00 sec)
Second, create a database

Create database name; For example: MariaDB [mysql]> create Databases Han; Query OK, 1 row affected (0.01 sec)  mariadb [mysql]> show databases;+--------------------+| Database |+--------------------+| Information_schema | | Han | | MySQL | | Performance_schema | | Test |+--------------------+5 rows in Set (0.00 sec)    Third, enter database use database name; for example: MariaDB [mysql]> use Han;database Changed. View table show TABLES; for example: MariaDB [han]> show tables;+---------------+| Tables_in_han |+---------------+| Redhat |+---------------+1 row in Set (0.00 sec)   v. New data table CREATE table data table name (column name 1 data type not null,-> column name 2 data type not NULL,.......,.. .->); MariaDB [han]> CREATE TABLE redhat (user varchar () not null,-> passwd varchar (n) not null->); Query OK, 0 rows affected (0.02 sec)   vi. View data table contents select * Form table name; For example: MariaDB [han]> select * from redhat;+------+--- -----+| user | passwd |+------+--------+| user | 123 |+------+--------+1 row in Set (0.00 sec)   VII. add data to table insert into table name VALUES (' first column data ', ' second column data '); For example: MariaDB [han]> insert INTO redhat values (' user ', ' 123 '); Query OK, 1 row Affected (0.00 sec)   Delete table data delete from table name WHERE column name = ' data '; for example: MariaDB [han]> select * from redhat;+ ------+--------+| user | passwd |+------+--------+1 row in Set (0.00 sec)   ix. Delete table name of drop tables table; For example: MariaDB [han]> drop table redhat->; Query OK, 0 rows affected (0.01 sec)   10, delete database drop databases name; for example: MariaDB [han]> drop Database Han; Query OK, 0 rows affected (0.05 sec)  

Simple operation for MySQL, mariadb

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.