CSG0811
CSG0811

Reputation: 643

Connect MySQL Workbench with Django in Eclipse in a mac

I am new to this so a silly question I am trying to make a demo website using Django for that I need a database.. Have downloaded and installed MySQL Workbench for the same. But I don't know how to setup this. Thank you in advance :) I tried googling stuff but didn't find any exact solution for the same. Please help

Upvotes: 0

Views: 1255

Answers (1)

anurag ambershette
anurag ambershette

Reputation: 46

I am a mac user. I have luckily overcome the issue with connecting Django to mysql workbench. I assume that you have already installed Django package created your project directory e.g. mysite.

  1. Initially after installation of MySQL workbench i have created a database : create database djo;
  2. Go to mysite/settings.py and edit following piece of block. NOTE: Keep Engine name "django.db.backends.mysql" while using MySQL server. and STOP the other Django MySQL service which might be running.

DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'NAME': 'djo', # Or path to database file if using sqlite3. # The following settings are not used with sqlite3: 'USER': 'root', 'PASSWORD': '****', # Replace **** with your set password. 'HOST': '127.0.0.1', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. 'PORT': '3306', # Set to empty string for default. } }

  1. now run manage.py to sync your database : $ python mysite/manage.py syncdb bash-3.2$ python manage.py syncdb Creating tables ... Creating table auth_permission Creating table auth_group_permissions Creating table auth_group Creating table auth_user_groups Creating table auth_user_user_permissions Creating table auth_user Creating table django_content_type Creating table django_session Creating table django_site

You just installed Django's auth system, which means you don't have any superusers defined. Would you like to create one now? (yes/no): yes Username (leave blank to use 'ambershe'): root Email address: [email protected] /Users/ambershe/Library/Containers/com.bitnami.django/Data/app/python/lib/python2.7/getpass.py:83: GetPassWarning: Can not control echo on the terminal. passwd = fallback_getpass(prompt, stream)

Warning: Password input may be echoed. Password: ****

Warning: Password input may be echoed. Password (again): ****

Superuser created successfully. Installing custom SQL ... Installing indexes ... Installed 0 object(s) from 0 fixture(s)

Upvotes: 1

Related Questions