美文网首页
服务器运维(不定时更新)

服务器运维(不定时更新)

作者: jiangadam | 来源:发表于2017-09-19 23:02 被阅读7次

1. Ubuntu服务器时间和tomcat时间不一致

今天碰到一个问题,就是服务器的时间和tomcat的时间不一致,导致数据库时间都是正确的,但是从数据库获取的时间出来显示的时候就出问题了,然后查看tomcat的logs得知服务器的时间跟电脑上的时间不一样

date -R  // 首先查看服务器的时间
tzselect   // 设置服务器的时间

但是这个方法不是正确, 使用下面这个方法

dpkg-reconfigure tzdata   // 选上海

然后重启服务器,在请求数据,正确。

MySQL常用操作

# 常用命令
mysql -uroot -p 回车 输入密码  # 链接数据库
status # 查看数据库状态
show databases # 显示所有数据库
use database # 切换数据库
show tables # 显示数据库中的所有数据表
show create table table_name # 显示数据表创建时的全部信息
show create view view_name # 视图
desc table_name # 查看数据表的属性信息以及个字段的描述

# 常用的数据库SQL语句

create database database_name # 创建数据库
# 创建表
create table student(
  id int unsigned auto_increment,
  name varchar(30) not null default '',
  age tinyint unsigned not null default 0,
  content text not null default '',
  primary key(id),
  key index_age(age)
)engine=innodb default charset=utf8;

#添加一个字段
alter table student add column sort tinyint not null default 0 after content;
alter table student column is_del tiny int not null default 0;

# 删除字段
alter table student drop column age;
alter table student drop age;

# 修改字段名和字段类型
alter table student change sort sort_desc tinyint not null default 1;

# 修改表明
alter table studnet rename to students;

# 修改表引擎
alter table student engine=myisam;

# 索引相关

# 添加主键
alter table student add primary key (id);

# 添加唯一索引
alter table student add unique(name)

# 添加INDEX
alter table student add index index_name ('name');

# 全文索引
alter table student add FULLTEXT ('content');

# 添加多列索引
alter table student add index index_name ('age', 'name');

# 查看索引
show index from studnet;

https://www.baidu.com/home/news/data/newspage?nid=11256019309637025310&n_type=0&p_from=1

相关文章

  • 服务器运维(不定时更新)

    1. Ubuntu服务器时间和tomcat时间不一致 今天碰到一个问题,就是服务器的时间和tomcat的时间不一致...

  • 运维工程师从月薪 5K 到 50K,中间都要学习什么?

    做 运维 感觉像网管怎么办?新工作运维3个多月,天天就是维护重启服务器,更新代码……感觉这样下去几年后就没有什么竞...

  • 进阶

    5k到50k 参考 做 运维 感觉像网管怎么办?新工作运维3个多月,天天就是维护重启服务器,更新代码……感觉这样下...

  • 也谈运维

    运维分三个层次:设备运维、架构运维和业务运维。设备运维是指维护操作系统和网络环境,例如保持系统更新;架构运维是指维...

  • linux 系统安全 步骤

    服务器安全运维网络安全运维数据安全运维1、账号安全删除特殊的用户和组:adm,lp,sync,shutdown,h...

  • 运维工程师使用的运维平台

    运维工程师使用的运维平台和工具包括: Web服务器:apache、tomcat、nginx、lighttpd 监控...

  • Linux运维日常使用软件和技能

    运维工程师使用的运维平台和工具包括: Web服务器:apache、tomcat、nginx、lighttpd 监控...

  • Centos7下安装PostgreSQL10

    最近工作中要把服务器的postgreSQL更新到10,运维什么的都要自己来,根据pylixm大神记录,自己整理下,...

  • 闲话IT运维-什么是IT运维?

    说起IT运维,不同的人有不同的理解,有的人认为IT运维就是修电脑、看机房的;有些人认为IT运维是负责公司服务器管理...

  • 2019-07-16

    day13 课程过半回顾总结 01. 第一阶段回顾:服务器硬件知识1.系统运维工作:网络安全运维云计算运维大数据运...

网友评论

      本文标题:服务器运维(不定时更新)

      本文链接:https://www.haomeiwen.com/subject/usaxvttx.html