从零开始搞定MySQL
2019-06-17 本文已影响0人
页面仔小杨
从零开始搞定MySQL
一、如何在Macbook上安装MySQL
https://jingyan.baidu.com/article/fa4125ac0e3c2928ac709204.html
二、安装navicat
http://www.pc6.com/mac/111878.html
三、操作
1.登录
mysql -u root -p // 输入密码进入mysql

2.查看数据库(这些是系统默认的,你还没有创建新的数据库)

3.创建数据库
create database mylearn; // 分号为结束符,必须有

4.查看当前使用的哪个数据库,切换数据库
select database();
use mylearn;

5.创建表
create table persons (personId int, lastName varchar(255), firstName varchar(255), address varchar(255), city varchar(255));

6.插入表中数据
insert into persons values (1,'it','xing','taobao','beijing');
select * from persons; // 查看表内容

7.更新表内容
update persons set address='zhengzhou' where city='beijing';

8.删除表中的记录
delete from persons where city='beijing';

9.退出
exit

更多操作自己百度一下吧