Skip to content

Instantly share code, notes, and snippets.

@haio
haio / gist:4577204
Last active December 11, 2015 08:59
some word meaningful
dubious design
typos
scratch
muckup
off-the-shelf
caveat
refinement
rectify
cumbersome
redundant
@haio
haio / gist:4577225
Created January 20, 2013 07:57
rspec integration_test
rials generate integration_test controller_page
@haio
haio / gist:4583310
Created January 21, 2013 02:53
random number 0 OR 1)
Math.round(Math.random())
Obsessive compulsive disorder,缩写:OCD
@haio
haio / gist:4583471
Created January 21, 2013 03:48
alias
alias migrate='rake db:migrate; rake db:migrate RAILS_ENV=test'
/etc/init.d/networking restart
@haio
haio / gist:4622240
Created January 24, 2013 14:25
MySQL change password
use mysql;
update user set password=password('new_password') where user='root';
FLUSH PRIVILEGES;
@haio
haio / gist:4623382
Last active December 11, 2015 15:48
设置mysql 5.5.29编码格式
mysql -uroot -p
show variables like "%char%";
exit
stop mysql
vi /etc/mysql/my.cnf
[mysqld]
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8
@haio
haio / gist:4632618
Created January 25, 2013 07:55
MySql常用命令
show columns from table_name;
show create table table_name;
show databases;
@haio
haio / gist:4640413
Last active December 11, 2015 18:19
mysql 权限控制
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'rootpasswd' WITH MAX_CONNECTIONS_PER_HOUR 5;
GRANT ALL PRIVILEGES ON *.* TO 'username'@'1.1.0.123' IDENTIFIED BY 'rootpasswd' MAX_CONNECTIONS_PER_HOUR 5;
GRANT SELECT ON dbname.* to 'username'@'%' IDENTIFIED BY by 'iamwangnc';
FLUSH PRIVILEGES;
select * from mysql.user;
REVOKE ALL PRIVILEGES ON *.* TO 'root'@'%';
delete from mysql.user where Host='%';
FLUSH PRIVILEGES;