数据是,学习编程的基本操作,下面为大家介绍一下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;
以上就是如何建立数据库的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号