刚装的系统,默认时间是UTC,比北京时间少了8个小时.
修改 /var/opt/gitlab/gitlab-rails/etc/gitlab.yml 配置文件中的 time_zone : ‘Beijing’
重启gitlab 即可
#gitlab-ctl restart
刚装的系统,默认时间是UTC,比北京时间少了8个小时.
修改 /var/opt/gitlab/gitlab-rails/etc/gitlab.yml 配置文件中的 time_zone : ‘Beijing’
重启gitlab 即可
#gitlab-ctl restart
使用Gitlab一键安装包安装Gitlab非常简单, 同样的备份恢复与迁移也非常简单. 使用一条命令即可创建完整的Gitlab备份:
gitlab-rake gitlab:backup:create
使用以上命令会在/var/opt/gitlab/backups
目录下创建一个名称类似为1393513186_gitlab_backup.tar
的压缩包, 这个压缩包就是Gitlab整个的完整部分, 其中开头的1393513186
是备份创建的日期.
你也可以通过修改/etc/gitlab/gitlab.rb
来修改默认存放备份文件的目录:
gitlab_rails['backup_path'] = '/mnt/backups'
/mnt/backups
修改为你想存放备份的目录即可, 修改完成之后使用gitlab-ctl reconfigure
命令重载配置文件即可. Continue reading
线上用的MySQL版本为5.7.11,线下用的5.6版本,发现将程序上线后,有些地方报这个错误
[Err] 1055 – Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column ‘information_schema.PROFILING.SEQ’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
ONLY_FULL_GROUP_BY:
对于GROUP BY聚合操作,若select中的列没有在group by中出现,那么这句SQL是不合法的。
解决办法下my.cnf中添加以下几行
[mysqld] sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
在sql_mode 中去掉only_full_group_by
==========================================
mysql> SELECT name, address, MAX(age) FROM t GROUP BY name;
ERROR 1055 (42000): Expression #2 of SELECT list is not in GROUP
BY clause and contains nonaggregated column 'mydb.t.address' which
is not functionally dependent on columns in GROUP BY clause; this
is incompatible with sql_mode=only_full_group_by
If you know that, for a given data set, each name
value in fact uniquely determines the address
value, address
is effectively functionally dependent on name
. To tell MySQL to accept the query, you can use the ANY_VALUE()
function:
SELECT name, ANY_VALUE(address), MAX(age) FROM t GROUP BY name;
Alternatively, disable ONLY_FULL_GROUP_BY
.
对于以前的语句,可以使用ANY_VALUE() 函数来解决。
对于SQL_MODE各值的用法见:http://blog.itpub.net/29773961/viewspace-1813501/
环境说明:
Centos 6.6 64位
mysql 使用最新版本5.7.16版本
这里安装两个MySQL实例,分别使用3306/3307端口号
目录结构:
/data/mysql/mysql3306
/data/mysql/mysql3306/data
/data/mysql/mysql3307/log
/data/mysql/mysql3306/tmp
执行命令:
mkdir -p /data/mysql/mysql3306/{data,tmp,log} mkdir -p /data/mysql/mysql3307/{data,tmp,log}
为了方便我们先配置mysql3306实例,配置成功后,再复制一份到3307即可。
tar zxvf mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz cp -rf mysql-5.7.16-linux-glibc2.5-x86_64/* /data/mysql/mysql3306/
权限修改
chown -R mysql:mysql /data/mysql/mysql3306
配置my.cnf Continue reading