您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

Mac OS 10.6.2 Snow Leopard上的Django + MySQL

Mac OS 10.6.2 Snow Leopard上的Django + MySQL

我最终解决了自己的问题,当然,我从许多已读过的帖子,博客邮件日志中获得了潜意识和有意识的帮助。如果我记得的话,我会提供链接

简而言之,我使用MacPorts重新安装了一切。

编辑?/ .bash_profile并注释掉对$ {PATH}的所有先前修改之后,我下载了SNow Leopard的dmg并完成了安装过程。

然后打开终端并运行自我更新。

@H_404_9@sudo port selfupdate
sudo port install python26

第二部分,安装Python 2.6,花费了很多时间。但是完成后,提示我以下内容

@H_404_9@To fully complete your installation and make python 2.6 the default, please run

sudo port install python_select  
sudo python_select python26

我都做了,他们很快就完成了。

我忘了提一下“端口搜索”命令有多方便。我搜索了“ MysqL”,并且类似地找到了“安装”后要键入的内容。但是我着手重新安装MysqL的客户端和服务器。也许我以相反的顺序进行了操作,但是最终结果还是不错的。

@H_404_9@sudo port install MysqL5
...
--->  Installing MysqL5 @5.1.41_0
The MysqL client has been installed.
If you also want a MysqL server, install the MysqL5-server port.

很自然地:

@H_404_9@sudo port install MysqL5-server

我喜欢这么多的Macports安装如何为你提供有关下一步操作的反馈。在服务器安装结束时,它显示以下内容

@H_404_9@******************************************************
* In order to setup the database, you might want to run
* sudo -u _MysqL MysqL_install_db5
* if this is a new install
******************************************************

对我来说,这是一个新安装(没有任何本地模式)。为了完整起见,以供我参考,以下是运行该命令的输出

@H_404_9@Installing MysqL system tables...
OK
Filling help tables...
OK

To start MysqLd at boot time you have to copy
support-files/MysqL.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MysqL root USER !
To do so, start the server, then issue the following commands:

/opt/local/lib/MysqL5/bin/MysqLadmin -u root password 'new-password'
/opt/local/lib/MysqL5/bin/MysqLadmin -u root -h iMac.local password 'new-password'

Alternatively you can run:
/opt/local/lib/MysqL5/bin/MysqL_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MysqL daemon with:
cd /opt/local ; /opt/local/lib/MysqL5/bin/MysqLd_safe &

You can test the MysqL daemon with MysqL-test-run.pl
cd /opt/local/MysqL-test ; perl MysqL-test-run.pl

Please report any problems with the /opt/local/lib/MysqL5/bin/MysqLbug script!

The latest information about MysqL is available at http://www.MysqL.com/
Support MysqL by buying support/licenses from http://shop.MysqL.com/

快完成了 在“端口搜索”的早期,我遇到了一个有趣的端口:

py26-MysqL @ 1.2.2(python,devel,数据库MysqL的Python接口

非常希望这会为我提供MysqLdb软件包,我安装了它(确实做到了)。

@H_404_9@sudo port install py26-MysqL

余言之后,我加速了python解释器的尝试,以导入MysqLdb,这一直都是我的方式。

@H_404_9@iMac:~ drhoden$ python
Python 2.6.4 (r264:75706, Dec 15 2009, 18:00:14) 
[GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import MysqLdb
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/MysqLdb/__init__.py:34: DeprecationWarning: the sets module is deprecated from sets import ImmutableSet
>>> 

警告,但是有效!!

还有一件事:

@H_404_9@sudo port install py26-django

完成所有这些工作之后,我终于能够启动Django项目并远程连接到公司的MysqL服务器!也许没有必要使用MacPorts重新安装Django,但是我并不会冒任何麻烦。

MySQL 2022/1/1 18:14:46 有539人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶