安装MySQL:
Ref:
Mysql的基本命令:
- http://218.194.248.2/~wuxiaogang/cpcourse/database/mysql/index.htm
- http://blog.csdn.net/mm_bit/article/details/51241082
sudo apt-get install mysql-server mysql-client libmysqld-dev
在Mac或Linux上,需要编辑MySQL的配置文件,把数据库默认的编码全部改为UTF-8。MySQL的配置文件默认存放在/etc/my.cnf或者/etc/mysql/my.cnf:
[client]
default-character-set = utf8
[mysqld]
default-storage-engine = INNODB
character-set-server = utf8
collation-server = utf8_general_ci
重启MySQL后,可以通过MySQL的客户端命令行检查编码:
$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor...
...
mysql> show variables like '%char%';
+--------------------------+--------------------------------------------------------+
| Variable_name | Value |
+--------------------------+--------------------------------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mysql-5.1.65-osx10.6-x86_64/share/charsets/ |
+--------------------------+--------------------------------------------------------+
8 rows in set (0.00 sec)
看到utf8字样就表示编码设置正确
安装Django操作MySQL的第三方依赖包:
sudo apt-get install python-dev
easy_install MySQL-python
简单的命令:
service mysql restart #重启mysql
mysql -u root -p #登陆mysql
Djgango配置MySQL:http://jingyan.baidu.com/article/cd4c2979e87e0a756e6e6083.html
Ref:
http://www.cnblogs.com/rencm/p/5220042.html
廖雪峰的日志
http://dmyz.org/archives/110