8种机械键盘轴体对比
本人程序员,要买一个写代码的键盘,请问红轴和茶轴怎么选?
因为最近在使用云服务器部署项目,所以也难免要在服务器上使用MySQL,所以就想把MySQL常使用记录下来,以便日后查看并熟悉~也希望能够对大家有所帮助~
首先你需要在云服务器上下载安装MySQL,网上有很多大牛们都写了相关的博客,这里就不再重复啦~
注意:MySQL 中每个命令后都要以分号;结尾。
显示数据库
show databases;1show databases;
Mysql 刚安装完有两个数据库:mysql 和test。mysql 库非常重要,它里面有MySQL 的系统信息,我们改密码和新增用户,实际上就是用这个库中的相关表进行操作。
建库:
create database 库名;
例如:创建一个名字位node的库1create database node;
建表:
create table 表名 (字段设定列表);
例如:在刚创建的node库中建立表user, 表中有uid(序号, 自动增长), username(姓名), password(密码), email(邮箱)四个字段1
2use node;
create table user (uid int(4) auto_increment not null primary key, username varchar(255), password varchar(255), email varchar(255));
显示数据库中的表
show tables;1
2use node; //打开库
show tables;
显示数据表的结构:
describe 表名;1describe user;
增加记录
例如:增加几条相关记录。1
2insert into user(username, password, email) values('qiuqiu', 'qqq',
insert into user(username, password, email) values('hehe', '123456',
显示表中的记录:
可以使用select * from 表名;来查看我们表中的数据1select * from user;
修改记录
例如:将qiuqiu的密码改为1231update user set password='123' where username='qiuqiu';
删除记录
例如:删除qiuqiu的纪录。1delete from user where username='qiuqiu';
删库和删表
drop database 库名;
drop table 表名;
增加MySQL 用户
grant select on 数据库.* to [email protected] identified by “密码”
例1、增加一个用户user_1密码为123,让他可以在任何主机上登录,并对所有数据库有查询、插入、修改、删除的权限。首先用以root用户连入MySQL ,然后键入以下命令:1grant select, insert, update, delete on *.* to mailto:user_1@" " Identified by "123";
备份与恢复
备份例如:将上例创建的node库备份到文件back_node中1
2# mysqldump -u root -p –opt node > back_node
恢复1# mysql -u root -p recover_node < back_node
总结
为了防止自己以后忘记,所以我在这里记录了一些通过命令而进行的一些常用的MySQL数据库操作,内容很简单,主要是为了便于自己以后查阅,也希望能够对大家有所帮助~