• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

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

mysql 搞代码 4年前 (2022-01-09) 12次浏览 已收录 0个评论

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

在阿里云上尝试使用了一下CentOS 7.0 的虚拟机,部署了一下Django应用,用到了MySQL,随手本文来源gaodai#ma#com搞@@代~&码*网/记录一点遇到的问题吧,可能很多是因为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.


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:在CentOS 7.x 上搭建Django/MySQL(MariaDB)

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址