1. 远程登录Mysqlserver:
mysql -uusername -p -hIP地址 -Pport号
然后输入password, 就可以登录到远程server
2. 显示/查看数据库
show databases;
3. 选择数据库
use 数据库名;
4. 显示/查看数据表
show tables;
5. 查看详细表结构
describe 详细表名;
6. 事务提交SQL
START TRANSACTION; INSERT INTO table VALUES("AA","text","0","2015-07-23 10:41:57","2015-07-23 10:41:57"); INSERT INTO table VALUES("BB","text","100","2015-07-23 10:41:57","2015-07-23 10:41:57"); COMMIT;
7. 改动字段大小
ALTER TABLE table_name MODIFY COLUMN 字段名 varchar(255);
8. 添加字段
ALTER TABLE table_name ADD field_name field_type DEFAULT default_value;
9. 查看索引
show index from table_name;
10. 查看全部字段
show full columns from table_name;
时间: 2024-11-03 20:52:02