首頁  >  文章  >  資料庫  >  在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