[root@node110 ~]# mysql -uroot -pyinzhengjie
mysql: [Warning] Using a password on the command line
interface
can be insecure.
Welcome to the MySQL monitor. Commands
end
with ;
or
\g.
Your MySQL connection id is 13
Server version: 8.0.14 MySQL Community Server - GPL
Copyright (c) 2000, 2019, Oracle
and
/
or
its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation
and
/
or
its
affiliates. Other names may be trademarks of their respective
owners.
Type
'help;'
or
'\h'
for
help. Type
'\c'
to clear the current input statement.
mysql>
mysql>
mysql> CREATE DATABASE devops CHARACTER SET = utf8;
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql>
mysql>
mysql>
use
devops
Database changed
mysql> show tables;
Empty
set (0.00 sec)
mysql>
mysql> CREATE TABLE students(stu_id INT(11),stu_name VARCHAR(50),gender INT(11)); #首先,我们这里只是创建了一张极为普通的表。
Query OK, 0 rows affected (0.01 sec)
mysql>
mysql> INSERT INTO students VALUES(1,
'jason'
,10); #插入第一条数据
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> INSERT INTO students VALUES(2,
'danny'
,20); #插入第二条数据
Query OK, 1 row affected (0.01 sec)
mysql>
mysql> INSERT INTO students VALUES(1,
'jenny'
,30); #插入第三条数据,注意!这个id和第一条插入的数据是相同的,别问我为什么这么干,我是故意这样搞的!
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> SELECT * FROM students; #我们查询咱们刚刚插入的三条数据
+--------+----------+--------+
| stu_id | stu_name | gender |
+--------+----------+--------+
| 1 | jason | 10 |
| 2 | danny | 20 |
| 1 | jenny | 30 |
+--------+----------+--------+
3 rows in set (0.00 sec)
mysql>