MacOS下启动/停止MySQL Service
本地连接MySQL Service,用户名:root,密码:abc123
$ mysql -hlocalhost -uroot -pabc123
显示数据库列表
mysql> show databases;
显示库中的数据表
mysql> use mysql;
mysql> show tables;
建库与删库
mysql> create database bcu;
mysql> drop database bcu;
建表与删表
mysql> use bcu;
mysql> create table finance(name varchar(32), amount int);
mysql> drop table finance;
显示数据表的结构
mysql> describe finance;
显示表中的记录
mysql> select * from finance;
往表中加入记录
mysql> insert into finance values("tanyun", 100);
更新表中数据
mysql> update finance set amount=150 where name='tanyun';
删除表中数据
mysql> delete from finance where name = 'tanyun’;
清空表中记录
mysql> delete from finance;