>  기사  >  데이터 베이스  >  在CentOS 7.x 上搭建Django/MySQL(MariaDB)

在CentOS 7.x 上搭建Django/MySQL(MariaDB)

WBOY
WBOY원래의
2016-06-07 16:42:041176검색

在阿里云上尝试使用了一下CentOS 7.0 的虚拟机,部署了一下Django应用,用到了MySQL,随手记录一点遇到的问题吧,可能很多是因为CenOS 7 引起的不适应(以前适应了CentOS 6.x)。 1. MySQL没了,取而代之的是MariaDB(当然Django中依然配置MySQL,与MariaDB

在阿里云上尝试使用了一下CentOS 7.0 的虚拟机,部署了一下Django应用,用到了MySQL,随手记录一点遇到的问题吧,可能很多是因为CenOS 7 引起的不适应(以前适应了CentOS 6.x)。
1. MySQL没了,取而代之的是MariaDB(当然Django中依然配置MySQL,与MariaDB是完全兼容),安装MariaDB的命令:

yum <span style="color: #c20cb9; font-weight: bold;">install</span> mariadb-server mariadb mariadb-devel

2. 服务配置变,使用systemctl而不是以前的service,以MariaDB、Nginx为例:

systemctl start mariadb.service    <span style="color: #666666; font-style: italic;">#启动MariaDB</span>
systemctl is-active mariadb.service   <span style="color: #666666; font-style: italic;">#检查MariaDB的运行状态</span>
systemctl <span style="color: #7a0874; font-weight: bold;">enable</span> mariadb.service   <span style="color: #666666; font-style: italic;">#配置为开机自启动</span>
 
systemctl reload nginx.service   <span style="color: #666666; font-style: italic;">#重新加载nginx的配置文件</span>

3. 安装MySQL-python(因为Django使用的是这个)时,也遇到了问题:
pip install MySQL-python 命令报错“#error MUST be included first!”。
按照:https://bazaar.launchpad.net/~maria-captains/maria/5.5/revision/4355 提供的方案来修改 /usr/include/mysql/my_config_x86_64.h 文件。
之后再重新装就好了,这是算是一个兼容性问题。

参考资料:

https://bugzilla.redhat.com/show_bug.cgi?id=1166603

http://www.cyberciti.biz/faq/howto-install-linux-apache-mariadb-php-lamp-stack-on-centos7-rhel7/

Original article: 在CentOS 7.x 上搭建Django/MySQL(MariaDB)

©2014 笑遍世界. All Rights Reserved.

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.