mysqltest
1.登陆数据库
- 连接本地mysql数据库
mysql -u用户名 -p - 连接其他电脑上的mysql数据库
mysql -u用户名 -p -hIP地址 -port端口
2.展示当前mysql中所有数据库
show databases;
3.创建数据库
create database testDB;
4.进入/切换 数据库中
use 数据库名;
use testDB;
5.可以开始操作数据库表。
create table t1(
num int(4) unsigned zerofill
);
insert into t1 values(18);
insert into t1 values(1.8);
insert into t1 values(1.1);
insert into t1 values(-1);
select * from t1;
create table t2(
money double(4,2) zerofill
);
insert into t2 values(3.1415926);
insert into t2 values(123.1415926); //error 超出了有效位数
select * from t2;
cre