Wednesday, February 5, 2014

Re: moving from sqlite3 to mysql

1. before exiting mysql, you should grant permission to a user,i.e.
grant all privileges on django_1.* to username@'localhost' identified by 'userpassword'
replace username, userpassword with your own
2. exit mysql console
3. modify settings.py to add your username, password, host (localhost), and port (3306)
4. run python manage.py syncdb


On Thu, Feb 6, 2014 at 7:52 AM, Drew Ferguson <drew@afccommercial.co.uk> wrote:
Hi

Just like SQLlite, you tell Django where the MySQL database is in
settings.py

At the top you should have something like

DATABASES = {
 'default': {
  'ENGINE': 'django.db.backends.mysql',
  'NAME': 'django_1', # Or path to database file if using sqlite3.
#  'USER': '',
#  'PASSWORD': '',
#  'HOST': '', # Empty for localhost
#  'PORT': '', # Set to empty string for default.
 }
}


On Wed, 5 Feb 2014 16:38:59 -0600
Malik Rumi <malik.a.rumi@gmail.com> wrote:

> mysql>  CREATE DATABASE django_1;
>
> Query OK, 1 row affected (0.24 sec)
>
> mysql> SHOW DATABASES;
>
> +--------------------+
>
> | Database           |
>
> +--------------------+
>
> | information_schema |
>
> | django_1           |
>
> | mysql              |
>
> | performance_schema |
>
> | test               |
>
> +--------------------+
>
> 5 rows in set (0.31 sec)
--
Drew Ferguson
AFC Commercial
http://www.afccommercial.co.uk

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20140205235235.53a238b1%40blacktav.fergiesontour.org.



--

DISCLAIMER: This message is for the designated recipient only and may contain confidential and/or privileged information. If you have received it in error, please delete it and advise the sender immediately. You should not copy or use it for any other purpose, nor disclose its contents to any other person.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAECOjiaW4jswaift33tcdTJc5DBwFYJhRKyZPmhn7FToC8QUvw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment