Tuesday, January 28, 2014

Re: moving from sqlite3 to mysql

"Or can I create the database, (presumably directly in the shell), and then empty it, as these instructions say, and that will take care of it? I frankly didn't understand why I would need to 'empty' a new and empty database, but that's what it says. "

With sql lite, everything will be created for you.
While with MySQL,  you should create the database directly in the shell, and this should give you an empty database.  The Django tables will be created after configuring your settings, and running  syncdb.




On Wed, Jan 29, 2014 at 1:17 AM, Malik Rumi <malik.a.rumi@gmail.com> wrote:
This is somewhat like the question in "need help moving to production server" but I think the right procedure is to start a new thread. So I think I have done well for just starting out. With your help I've gotten Django running on Windows, and I completed a tutorial and got my site working locally with the admin. thank you.

So I thought I was ready to move up to MySQL for some heavy lifting. I followed the instructions I got here http://matthewwittering.com/blog/how-to-migrating-the-database-engine-for-django.html. I did not know what to do with the NAME part, so I put in 'django-1', and promptly got the error message 'unknown database 'django-1'. I thought that made sense because I hadn’t created this database in mysql already, but I was just blindly following along. Having to CREATE DATABASE doesn’t make sense, I thought, because it defeats the purpose of Django abstraction in the first place. Besides, when I syncdb, it should take whatever name I gave it when I was using sqlite3, right?

Wrong. When I ran syncdb, this time with NAME: ' ', I got :   File "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 36, in default terror handler    raise errorclass, errorvalue django.db.utils.OperationalError: (1046, 'No database selected').

So, what am I missing here? There almost certainly is an easy solution I'm not seeing. Do I need to create a database in mysql? If so, must it have the same name as it had in sqlite3? I know that name was made from putting the model name together with something else, but I don't actually remember what it was, and it seems like a lot of extra work to install an sqlite browser just to get that name right. If that's what I need to do, maybe I can just open that file with notepad? 

Or can I create the database, (presumably directly in the shell), and then empty it, as these instructions say, and that will take care of it? I frankly didn't understand why I would need to 'empty' a new and empty database, but that's what it says. 

Any and all helpful advise welcome and appreciated. 

--
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/f4a6d446-7cf8-498a-8ba5-04e339dd80b9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--

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/CAECOjiZL2Jx0M%2BYVdpX45TQDfQBGNgzMGGmOo6XiGb6JtwVkgQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment