Home  >  Article  >  Database  >  在CentOS 7.x 上搭建Django/MySQL(MariaDB)

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

WBOY
WBOYOriginal
2016-06-07 16:42:041176browse

在阿里云上尝试使用了一下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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn