重庆小潘seo博客

当前位置:首页 > 重庆网络营销 > 小潘杂谈 >

小潘杂谈

如何建立数据库

时间:2020-09-23 05:40:07 作者:重庆seo小潘 来源:
数据是,学习编程的基本操作,下面为大家介绍一下mysql如何创建数据库。 推荐教程:MySQL入门视频教程 前提:电脑安装了mysql服务。如果不知道怎么安装mysql服务,可以参考https://www.php.cn/mysql-tutorials-362227.html 1、登录数据库 代码:mysql -u roo

如何建立数据库

数据是,学习编程的基本操作,下面为大家介绍一下mysql如何创建数据库。

推荐教程:MySQL入门视频教程

前提:电脑安装了mysql服务。如果不知道怎么安装mysql服务,可以参考https://www.php.cn/mysql-tutorials-362227.html

1、登录数据库

代码:mysql -u root -p输入密码

如何建立数据库

2、创建数据库

代码:create database test;如何建立数据库

3、使用刚才创建的数据库

代码:use test;如何建立数据库

4、创建一张表

代码:create table user(id int not null,username varchar(100) not null,password varchar(100) not null,primary key(id));如何建立数据库

5、向表里添加一条数据insert into user(id,username,password) values(1,'zhang','123');如何建立数据库

6、查询数据

代码:select * from user;如何建立数据库以上就是如何建立数据库的详细内容,更多请关注小潘博客其它相关文章!