为了完当作springboot-jpa-MySQL一个简单的项目,必需先设置装备摆设mysql数据库,建立一个数据库mytest,并在数据库mytest下建立一张表user。
这一部门就是筹办工作,首先确认已经安装了mysql。
接下来就是,毗连mysql,并建立数据库和表。
工具/原料
- mysql
方式/步骤
- 1
毗连mysql,打开mysql的bin目次:C:\Program Files\MySQL\MySQL Server 5.7\bin
(1)按住shift,右键,“在此处打开号令”,输入:mysql -uroot -p


- 2
(2)若是提醒不克不及毗连mysql,查看,mysql办事是否打开。
(3)打开办事,找到mysql办事,并启动

- 3
(4)从头输入号令:mysql -uroot -p,然后输入密码:
(5)可以看到进入了mysql

- 4
建立数据库。
建立数据库mytest,号令:create database mytest;
进入mytest,号令:use mytest;

- 5
在mytest数据库中,建立表user;本家儿键id主动增加。
create table user(
id bigint not null auto_increment,
name varchar(50),
sex varchar(10),
phone varchar(20),
primary key PK_positon (id));

- 6
展示库mytest中的表,号令:show tables;
查看表user的具体信息:describe user;

- 7
至此,mysql的库和表就建立好了。








