记一次脚本跑错需要恢复数据的事故... 1.我这里已经有了备份数据,首先download下来,然后准备一个版本和恢复数据库一致的数据库,我这里是MySQL5.6 2.查看数据库文件位置 mysql> show variables like '%dir%'; 找到这一行 | datadir ...
今天突然有人反应程序部分功能异常,保存不了数据,赶紧上服务器看一下。首先习惯性用`git status`和`git log`检查一下代码,发现都是正常的,然后测试了一下插入数据,发现部分插入是正常的,于是联想到会不会是sql_mode的问题,一看,果然: mysql> show v...
前言 之前在处理ip地址的时候一直是直接保存为字符串类型,最近看到另一种处理方法,原理上其实是把ip地址转为无符号整型来保存,相较于字符串保存的方式会更省空间,同时MySQL中对整型的处理也比字符串类型的要快 1.创建表`user` mysql> CREATE TABLE...
在Django上出现了这个错误,`ValueError: Database returned an invalid datetime value. Are time zone definitions for your database and pytz installed?`,pip freeze 一下,发现 pytz 已经装了,看来是MySQL的设置问题。 解决方法 mysql_tzinfo_to_sql /usr/sh...
PhantomJS默认采用utf-8编码,如果你爬回来的内容输出中文是乱码,多半是编码的锅,改为gbk即可。 有两种方法解决: 1.通过`phantomjs -h`命令可以发现有这么一行 --output-encoding=<val> Sets the encoding for the terminal output, default ...
31. Next Permutation Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascendi...
25. Reverse Nodes in k-Group Given a linked list, reverse the nodes of a linked list _k_ at a time and return its modified list. If the number of nodes is not a multiple of _k_ then left-out nodes in the end should remain as it is. You may not alt...
17. Letter Combinations of a Phone Number Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is given below. Input:Digit string "23" Output: ["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"]. Note: Al...
综述 默认maven仓库在国内访问实在是太慢了,经常下载失败,试过几个镜像后,发现阿里云的maven镜像速度不错。 修改方法 一般不建议直接改maven的全局配置文件,所以我们到`/path/to/maven/conf/`下面复制一份settings.xml到用户目录的.m2目录下,即`~/.m2/`,然后编...