mysql
图形化界面:http://localhost/phpmyadmin/
命令行:在xampp上打开shell
# mysql -uroot//打开MySQL Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 2 Server version: 10.1.37-MariaDB mariadb.org binary distribution Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> create database tese2//创建一个数据库 Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> show databases//show所有建的数据库 -> ; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | phpmyadmin | | tese2 | | test | | text1 | +--------------------+ 7 rows in set (0.00 sec) MariaDB [(none)]> drop database tese2;//删除数据库tese2 Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | phpmyadmin | | test | | text1 | +--------------------+ 6 rows in set (0.00 sec) MariaDB [(none)]> create database test2 -> ; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> use test2 Database changed MariaDB [test2]> create table student//创建了表 -> (id int(10) -> ); Query OK, 0 rows affected (1.39 sec) MariaDB [test2]> show tables;//展现所建的表 +-----------------+ | Tables_in_test2 | +-----------------+ | student | +-----------------+ 1 row in set (0.00 sec) MariaDB [test2]> drop table student;//删除表student Query OK, 0 rows affected (0.18 sec) MariaDB [test2]> create table student -> (id int(10), -> name varchar(20) -> ); Query OK, 0 rows affected (0.21 sec) MariaDB [test2]> insert into student values(1,"robert");//增加元组 Query OK, 1 row affected (0.05 sec) MariaDB [test2]> select *from student; +------+--------+ | id | name | +------+--------+ | 1 | robert | +------+--------+ 1 row in set (0.00 sec) MariaDB [test2]> insert into student(id) values(2);//增加指定的列的值(忘记叫什么了) Query OK, 1 row affected (0.25 sec) MariaDB [test2]> select *from student; +------+--------+ | id | name | +------+--------+ | 1 | robert | | 2 | NULL | +------+--------+ 2 rows in set (0.00 sec) MariaDB [test2]> update student set name="lili" where id=2//修改 -> ; Query OK, 1 row affected (0.05 sec) Rows matched: 1 Changed: 1 Warnings: 0 MariaDB [test2]> select *from student; +------+--------+ | id | name | +------+--------+ | 1 | robert | | 2 | lili | +------+--------+ 2 rows in set (0.00 sec) MariaDB [test2]> delete from student where id=2;//删除某个元组 Query OK, 1 row affected (0.33 sec) MariaDB [test2]> select *from student; +------+--------+ | id | name | +------+--------+ | 1 | robert | +------+--------+ 1 row in set (0.00 sec) MariaDB [test2]> delete from student;//删除表中所有的元组 Query OK, 1 row affected (0.06 sec) MariaDB [test2]> select *from student; Empty set (0.00 sec)
微信扫码关注
更新实时通知