今天有些时间,决定把电脑整理一下 ,打算学习一下linux和python,上午花了一个小时装上了centos 6.0系统,感觉界面很干净,初步用了一下,还好记得几个命令 。
罗嗦了很多,开始搭建Django框架,首先下载了mysq l-5.6.4的源码,准备编译,发现./configure无效,查了一下帮助文档,发现还需要cmake,
sudo yum install cmake ,安装好cmake工具
编译mysql
1 .cd .../mysql-5-6-4-m7
2. cmake ./
3. make
4 make install
编译成功
直接执行 ./mysqld_safe --user=root
发生错误
[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
查了一下baidu,原来是权限没有设置
5. ./scripts/mysql_install_db --user=mysql,解决问题
然后在启动的时候仍然报错
[ERROR] /usr/local/mysql/bin/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 2)
仍然问了下baidu,是权限方面的问题,
# mkdir mysqld
# chown -R mysql:mysql /var/run/mysqld 详细见http://www.itpub.net/thread-1406421-1-1.html
解决。
后来启动还是不成功,查看了一下log文件,error: ‘Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)’
这个问题相对简单些,可以设置/etc/my.cnf文件,手动设置sock文件,也可以这种方式解决:
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
然后通过 ./mysqld_safe --user=mysql &启动成功
最后:
[root@localhost bin]# ./mysql -u mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.4-m7 Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
终于成功启动了mysql服务器
为了搭建Django框架,首先下载了所需的库:setuptools-0.6c11,MySQL-python-1.2.3 ,Django-1.3.1
工具全了,设置就简单,首先通过命令:python setup.py install 安装setup tools,然后安装MySQL-python-1.2.3
在这时也出了点问题,这时根据系统情况,需要对site.cfg做些调整,
embedded = False
threadsafe = True
static = False
安装成功。
然后对Django设置,通过简单的命令,安装成功。
下一章对Django的具体用法再写点东西。