Mysql
 sql >> Datenbank >  >> RDS >> Mysql

Django + MySQL unter Mac OS 10.6.2 Snow Leopard

Letztendlich habe ich mein eigenes Problem gelöst, natürlich mit der unbewussten und bewussten Hilfe der vielen Beiträge, Blogs und Mail-Protokolle, die ich gelesen habe. Ich würde Links geben, wenn ich mich erinnern könnte.

Kurz gesagt, ich habe ALLES mit MacPorts neu installiert.

Nachdem ich ~/.bash_profile bearbeitet und alle vorherigen Änderungen an ${PATH} auskommentiert hatte, lud ich den dmg für Snow Leopard und lief durch seine Installation.

Öffnen Sie dann das Terminal und führen Sie das Selbstupdate aus.

sudo port selfupdate
sudo port install python26

Dieser zweite Teil, die Installation von Python 2.6, dauerte ewig. Aber als es fertig war, wurde mir Folgendes angezeigt:

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

sudo port install python_select  
sudo python_select python26

Ich habe beides gemacht und es ging schnell.

Ich habe vergessen zu erwähnen, wie praktisch der Befehl „Port Search“ ist. Ich habe nach „mysql“ und ähnlichem gesucht, um das Ding zu finden, das nach „install“ eingegeben werden muss. Aber ich fuhr damit fort, sowohl den Client als auch den Server für MySQL neu zu installieren. Vielleicht habe ich das in umgekehrter Reihenfolge gemacht, aber das Endergebnis hat gut funktioniert.

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.

Also natürlich:

sudo port install mysql5-server

Ich finde es toll, wie die vielen Macports-Installationen Ihnen Feedback geben, was als nächstes zu tun ist. Am Ende der Serverinstallation stand folgendes:

******************************************************
* In order to setup the database, you might want to run
* sudo -u _mysql mysql_install_db5
* if this is a new install
******************************************************

Es war eine Neuinstallation für mich (hatte keine lokalen Schemas). Der Vollständigkeit halber und zu meiner eigenen Referenz ist hier die Ausgabe dieses Befehls:

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/

Fast fertig. Früher bei meiner 'Port-Suche' bin ich auf diesen interessanten Port gestoßen:

py26-mysql @1.2.2 (python, devel, databases)Python-Schnittstelle zu mysql

Mit viel, viel Hoffnung, dass dies mir das MySQLdb-Paket liefern würde, habe ich es installiert (und es hat es getan).

sudo port install py26-mysql

Danach habe ich den Python-Interpreter hochgefahren und versucht, MySQLdb zu importieren, genau das stand mir die ganze Zeit im Weg.

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
>>> 

Eine Warnung, aber es hat funktioniert!!

Nur noch eine Sache:

sudo port install py26-django

Nach all dem war ich endlich in der Lage, mein Django-Projekt hochzufahren und eine Remote-Verbindung zum MySQL-Server meiner Firma herzustellen!! Es war vielleicht nicht nötig, Django mit MacPorts neu zu installieren, aber ich wollte keine Komplikationen riskieren.