- 注意,所有有关mysql测试都在cmd中实现的。
- 打开cmd快捷键:win+r;输入cmd.
- C:\Users\虚无>mysql -u root -p//输入要打开的数据库,但在此之前要配置环境
- Enter password: **// 密码在PHP中查看
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is 18
- Server version: 5.7.26 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.

- Microsoft Windows [版本 10.0.18363.1198]
- (c) 2019 Microsoft Corporation。保留所有权利。
- C:\Users\虚无>mysql -u root -p//输入数据库打开
- Enter password: **//密码
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is 21
- Server version: 5.7.26 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> create database guo;//创建一个guo的数据库
- Query OK, 1 row affected (0.00 sec)
- mysql> use guo;//使用刚创建好的数据库
- Database changed
- mysql> create table student1;//在guo的里面创建一个表格student1
- ERROR 1113 (42000): A table must have at least 1 column//error是错误提示,如果没有错误则可能断开连接,重新输入
- mysql> create table student1(//建立一个表格
- -> id int,//输入int形变量
- -> name varchar(20),相当于c语言中的char
- -> age int,
- -> sex varchar(5)
- -> )engine myisam charset utf8;结束标志语句
- Query OK, 0 rows affected (0.02 sec)//当出现这个语句则创建成功
- 以下是输入信息格式,新输入的信息默认往下排
- mysql> insert into student1(id,name,age,sex) values//一定要注意单词拼写!!!!
- 如果重新打开cmd然后输入数据,要先打开root,然后guo数据库再输入insert…….
- -> (1,’汪科’,19,’男’);
- Query OK, 1 row affected (0.00 sec)
- mysql> alter table student1 change sex 性别 varchar(5) default ‘男’;
- Query OK, 0 rows affected (0.01 sec)
- Records: 0 Duplicates: 0 Warnings: 0
