标签:int dha values rom tab redhat one arch mariadb
mysql的简单操作SHOW DATABASES;
例如:
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
CREATE DATABASE 数据库名称;
例如:
MariaDB [mysql]> create database 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)
USE 数据库名称;
例如:
MariaDB [mysql]> use han;
Database changed
SHOW TABLES;
例如:
MariaDB [han]> show tables;
+---------------+
| Tables_in_han |
+---------------+
| redhat |
+---------------+
1 row in set (0.00 sec)
CREATE TABLE 数据表名称(
->列名称1 数据类型 not null,
->列名称2 数据类型 not null,
. . . ,
. . . ,
. . .
->);
MariaDB [han]> create table redhat(
-> user varchar(50) not null,
-> passwd varchar(50) not null
-> );
Query OK, 0 rows affected (0.02 sec)
SELECT * FORM 表名称;
例如:
MariaDB [han]> select * from redhat;
+------+--------+
| user | passwd |
+------+--------+
| user | 123 |
+------+--------+
1 row in set (0.00 sec)
INSERT INTO 表名称 VALUES(‘第一列数据’,‘第二列数据’);
例如:
MariaDB [han]> insert into redhat values(‘user‘,‘123‘)
-> ;
Query OK, 1 row affected (0.00 sec)
DELETE FROM 表名称 WHERE 列名=‘数据’;
例如:
MariaDB [han]> select * from redhat;
+------+--------+
| user | passwd |
+------+--------+
1 row in set (0.00 sec)
DROP TABLE 表名称;
例如:
MariaDB [han]> drop table redhat
-> ;
Query OK, 0 rows affected (0.01 sec)
DROP DATABASE 数据库名称;
例如:
MariaDB [han]> drop database han;
Query OK, 0 rows affected (0.05 sec)
标签:int dha values rom tab redhat one arch mariadb
原文地址:http://blog.51cto.com/6078750/2154493