Re: Newbie question: first project can't connect to MySQL

2013-08-09 Thread Robert
I got the same problem. I solved it just now.
http://stackoverflow.com/questions/18150858/operationalerror-2002-cant-connect-to-local-mysql-server-through-socket-v

On Thursday, February 5, 2009 1:41:21 AM UTC+8, Kevin Audleman wrote:
>
> Hello everyone, 
>
> I am running through the tutorial and setting up my first django 
> project. Quite exciting! However I have run into trouble connecting to 
> MySQL. My settings.py file looks like this: 
>
> DATABASE_ENGINE = 'mysql'   # 'postgresql_psycopg2', 
> 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 
> DATABASE_NAME = 'test' # Or path to database file if using 
> sqlite3. 
> DATABASE_USER = 'root' # Not used with sqlite3. 
> DATABASE_PASSWORD = '' # Not used with sqlite3. 
> DATABASE_HOST = '' # Set to empty string for localhost. 
> Not used with sqlite3. 
> DATABASE_PORT = '' # Set to empty string for default. Not 
> used with sqlite3. 
>
> Yes, the username is 'root' and there is no password. This is on my 
> local machine (OS X 10.5) so it doesn't matter. 
>
> When I run... 
>
> $ python manage.py syncdb 
>
> I get the following... 
>
> Traceback (most recent call last): 
>   File "manage.py", line 11, in  
> execute_manager(settings) 
>   File "/Library/Python/2.5/site-packages/django/core/management/ 
> __init__.py", line 340, in execute_manager 
> utility.execute() 
>   File "/Library/Python/2.5/site-packages/django/core/management/ 
> __init__.py", line 295, in execute 
> self.fetch_command(subcommand).run_from_argv(self.argv) 
>   File "/Library/Python/2.5/site-packages/django/core/management/ 
> base.py", line 192, in run_from_argv 
> self.execute(*args, **options.__dict__) 
>   File "/Library/Python/2.5/site-packages/django/core/management/ 
> base.py", line 218, in execute 
> self.validate() 
>   File "/Library/Python/2.5/site-packages/django/core/management/ 
> base.py", line 246, in validate 
> num_errors = get_validation_errors(s, app) 
>   File "/Library/Python/2.5/site-packages/django/core/management/ 
> validation.py", line 65, in get_validation_errors 
> connection.validation.validate_field(e, opts, f) 
>   File "/Library/Python/2.5/site-packages/django/db/backends/mysql/ 
> validation.py", line 8, in validate_field 
> db_version = connection.get_server_version() 
>   File "/Library/Python/2.5/site-packages/django/db/backends/mysql/ 
> base.py", line 277, in get_server_version 
> self.cursor() 
>   File "/Library/Python/2.5/site-packages/django/db/backends/ 
> __init__.py", line 56, in cursor 
> cursor = self._cursor(settings) 
>   File "/Library/Python/2.5/site-packages/django/db/backends/mysql/ 
> base.py", line 262, in _cursor 
> self.connection = Database.connect(**kwargs) 
>   File "/Users/audleman/django_projects/pollster/__init__.py", line 
> 74, in Connect 
>
>   File "/Library/Python/2.5/site-packages/MySQL_python-1.2.2-py2.5- 
> macosx-10.5-i386.egg/MySQLdb/connections.py", line 170, in __init__ 
> _mysql_exceptions.OperationalError: (2002, "Can't connect to local 
> MySQL server through socket '/tmp/mysql.sock' (2)") 
>
>
> I'm not exactly sure what this socket is or why django can't find it. 
> One thought is that I installed LAMP on my machine using XAMPP, which 
> puts everything in the /Applications/xampp directory. Poking around, I 
> managed to find a mysql.sock file here: 
>
> /Applications/xampp/xamppfiles/var/mysql/mysql.sock 
>
> Assuming this is the correct socket, how do I tell django where to 
> find it? 
>
> Thanks, 
> Kevin 
>

-- 
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+unsubscr...@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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Newbie question: first project can't connect to MySQL

2012-10-05 Thread Javier Guerra Giraldez
On Fri, Oct 5, 2012 at 3:02 PM, Kurtis Mullins  wrote:
> Also, if memory serves me correctly, MySQL may be setup to allow connections
> from 127.0.0.1 but not Localhost

AFAIK, there are at least three different ways to connect to a local
server, each can be allowed/denied individually:

A: unix socket (something like /var/run/mysqld/mysqld.sock)

B: 127.0.0.1

C: a valid IP number that happens to be (one of) your own

-- 
Javier

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Newbie question: first project can't connect to MySQL

2012-10-05 Thread Kurtis Mullins
Also, if memory serves me correctly, MySQL may be setup to allow
connections from 127.0.0.1 but not Localhost

On Fri, Oct 5, 2012 at 2:45 PM, Mohamad Efazati wrote:

> Hi afshin
> localhost is kind of pointer to 127.0.0.1, maybe in /etc/hosts or other
> thing you overwrite it.
> so 127.0.0.1 is source and always work.
>
>
> 2012/10/4 Afshin Mehrabani 
>
>> Hey Kevin,
>>
>> Thanks for your correct reply, I had this problem also but after changing
>> host from "localhost" to "127.0.0.1" problem solved, But why? what's the
>> different between 'localhost' and '127.0.0.1'?
>>
>> On Wednesday, February 4, 2009 9:15:32 PM UTC+3:30, Kevin Audleman wrote:
>>>
>>> I found the solution in the archives: I changed DATABASE_HOST to
>>> 127.0.0.1 from ''
>>>
>>> Kevin
>>>
>>> On Feb 4, 9:41 am, Kevin Audleman  wrote:
>>> > Hello everyone,
>>> >
>>> > I am running through the tutorial and setting up my first django
>>> > project. Quite exciting! However I have run into trouble connecting to
>>> > MySQL. My settings.py file looks like this:
>>> >
>>> > DATABASE_ENGINE = 'mysql'   # 'postgresql_psycopg2',
>>> > 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
>>> > DATABASE_NAME = 'test' # Or path to database file if using
>>> > sqlite3.
>>> > DATABASE_USER = 'root' # Not used with sqlite3.
>>> > DATABASE_PASSWORD = '' # Not used with sqlite3.
>>> > DATABASE_HOST = '' # Set to empty string for localhost.
>>> > Not used with sqlite3.
>>> > DATABASE_PORT = '' # Set to empty string for default. Not
>>> > used with sqlite3.
>>> >
>>> > Yes, the username is 'root' and there is no password. This is on my
>>> > local machine (OS X 10.5) so it doesn't matter.
>>> >
>>> > When I run...
>>> >
>>> > $ python manage.py syncdb
>>> >
>>> > I get the following...
>>> >
>>> > Traceback (most recent call last):
>>> >   File "manage.py", line 11, in 
>>> > execute_manager(settings)
>>> >   File "/Library/Python/2.5/site-**packages/django/core/**management/
>>> > __init__.py", line 340, in execute_manager
>>> > utility.execute()
>>> >   File "/Library/Python/2.5/site-**packages/django/core/**management/
>>> > __init__.py", line 295, in execute
>>> > self.fetch_command(subcommand)**.run_from_argv(self.argv)
>>> >   File "/Library/Python/2.5/site-**packages/django/core/**management/
>>> > base.py", line 192, in run_from_argv
>>> > self.execute(*args, **options.__dict__)
>>> >   File "/Library/Python/2.5/site-**packages/django/core/**management/
>>> > base.py", line 218, in execute
>>> > self.validate()
>>> >   File "/Library/Python/2.5/site-**packages/django/core/**management/
>>> > base.py", line 246, in validate
>>> > num_errors = get_validation_errors(s, app)
>>> >   File "/Library/Python/2.5/site-**packages/django/core/**management/
>>> > validation.py", line 65, in get_validation_errors
>>> > connection.validation.**validate_field(e, opts, f)
>>> >   File "/Library/Python/2.5/site-**packages/django/db/backends/**mysql/
>>>
>>> > validation.py", line 8, in validate_field
>>> > db_version = connection.get_server_version(**)
>>> >   File "/Library/Python/2.5/site-**packages/django/db/backends/**mysql/
>>>
>>> > base.py", line 277, in get_server_version
>>> > self.cursor()
>>> >   File "/Library/Python/2.5/site-**packages/django/db/backends/
>>> > __init__.py", line 56, in cursor
>>> > cursor = self._cursor(settings)
>>> >   File "/Library/Python/2.5/site-**packages/django/db/backends/**mysql/
>>>
>>> > base.py", line 262, in _cursor
>>> > self.connection = Database.connect(**kwargs)
>>> >   File "/Users/audleman/django_**projects/pollster/__init__.py"**,
>>> line
>>> > 74, in Connect
>>> >
>>> >   File "/Library/Python/2.5/site-**packages/MySQL_python-1.2.2-**py2.5-
>>>
>>> > macosx-10.5-i386.egg/MySQLdb/**connections.py", line 170, in __init__
>>> > _mysql_exceptions.**OperationalError: (2002, "Can't connect to local
>>> > MySQL server through socket '/tmp/mysql.sock' (2)")
>>> >
>>> > I'm not exactly sure what this socket is or why django can't find it.
>>> > One thought is that I installed LAMP on my machine using XAMPP, which
>>> > puts everything in the /Applications/xampp directory. Poking around, I
>>> > managed to find a mysql.sock file here:
>>> >
>>> > /Applications/xampp/**xamppfiles/var/mysql/mysql.**sock
>>> >
>>> > Assuming this is the correct socket, how do I tell django where to
>>> > find it?
>>> >
>>> > Thanks,
>>> > Kevin
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/django-users/-/0dD75LGNe6UJ.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>> --
>> با تشکر
>> اف

Re: Newbie question: first project can't connect to MySQL

2012-10-05 Thread Mohamad Efazati
Hi afshin
localhost is kind of pointer to 127.0.0.1, maybe in /etc/hosts or other
thing you overwrite it.
so 127.0.0.1 is source and always work.


2012/10/4 Afshin Mehrabani 

> Hey Kevin,
>
> Thanks for your correct reply, I had this problem also but after changing
> host from "localhost" to "127.0.0.1" problem solved, But why? what's the
> different between 'localhost' and '127.0.0.1'?
>
> On Wednesday, February 4, 2009 9:15:32 PM UTC+3:30, Kevin Audleman wrote:
>>
>> I found the solution in the archives: I changed DATABASE_HOST to
>> 127.0.0.1 from ''
>>
>> Kevin
>>
>> On Feb 4, 9:41 am, Kevin Audleman  wrote:
>> > Hello everyone,
>> >
>> > I am running through the tutorial and setting up my first django
>> > project. Quite exciting! However I have run into trouble connecting to
>> > MySQL. My settings.py file looks like this:
>> >
>> > DATABASE_ENGINE = 'mysql'   # 'postgresql_psycopg2',
>> > 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
>> > DATABASE_NAME = 'test' # Or path to database file if using
>> > sqlite3.
>> > DATABASE_USER = 'root' # Not used with sqlite3.
>> > DATABASE_PASSWORD = '' # Not used with sqlite3.
>> > DATABASE_HOST = '' # Set to empty string for localhost.
>> > Not used with sqlite3.
>> > DATABASE_PORT = '' # Set to empty string for default. Not
>> > used with sqlite3.
>> >
>> > Yes, the username is 'root' and there is no password. This is on my
>> > local machine (OS X 10.5) so it doesn't matter.
>> >
>> > When I run...
>> >
>> > $ python manage.py syncdb
>> >
>> > I get the following...
>> >
>> > Traceback (most recent call last):
>> >   File "manage.py", line 11, in 
>> > execute_manager(settings)
>> >   File "/Library/Python/2.5/site-**packages/django/core/**management/
>> > __init__.py", line 340, in execute_manager
>> > utility.execute()
>> >   File "/Library/Python/2.5/site-**packages/django/core/**management/
>> > __init__.py", line 295, in execute
>> > self.fetch_command(subcommand)**.run_from_argv(self.argv)
>> >   File "/Library/Python/2.5/site-**packages/django/core/**management/
>> > base.py", line 192, in run_from_argv
>> > self.execute(*args, **options.__dict__)
>> >   File "/Library/Python/2.5/site-**packages/django/core/**management/
>> > base.py", line 218, in execute
>> > self.validate()
>> >   File "/Library/Python/2.5/site-**packages/django/core/**management/
>> > base.py", line 246, in validate
>> > num_errors = get_validation_errors(s, app)
>> >   File "/Library/Python/2.5/site-**packages/django/core/**management/
>> > validation.py", line 65, in get_validation_errors
>> > connection.validation.**validate_field(e, opts, f)
>> >   File "/Library/Python/2.5/site-**packages/django/db/backends/**mysql/
>>
>> > validation.py", line 8, in validate_field
>> > db_version = connection.get_server_version(**)
>> >   File "/Library/Python/2.5/site-**packages/django/db/backends/**mysql/
>>
>> > base.py", line 277, in get_server_version
>> > self.cursor()
>> >   File "/Library/Python/2.5/site-**packages/django/db/backends/
>> > __init__.py", line 56, in cursor
>> > cursor = self._cursor(settings)
>> >   File "/Library/Python/2.5/site-**packages/django/db/backends/**mysql/
>>
>> > base.py", line 262, in _cursor
>> > self.connection = Database.connect(**kwargs)
>> >   File "/Users/audleman/django_**projects/pollster/__init__.py"**,
>> line
>> > 74, in Connect
>> >
>> >   File "/Library/Python/2.5/site-**packages/MySQL_python-1.2.2-**py2.5-
>>
>> > macosx-10.5-i386.egg/MySQLdb/**connections.py", line 170, in __init__
>> > _mysql_exceptions.**OperationalError: (2002, "Can't connect to local
>> > MySQL server through socket '/tmp/mysql.sock' (2)")
>> >
>> > I'm not exactly sure what this socket is or why django can't find it.
>> > One thought is that I installed LAMP on my machine using XAMPP, which
>> > puts everything in the /Applications/xampp directory. Poking around, I
>> > managed to find a mysql.sock file here:
>> >
>> > /Applications/xampp/**xamppfiles/var/mysql/mysql.**sock
>> >
>> > Assuming this is the correct socket, how do I tell django where to
>> > find it?
>> >
>> > Thanks,
>> > Kevin
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/0dD75LGNe6UJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
> --
> با تشکر
> افاضاتی
> http://www.efazati.org
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.c

Re: Newbie question: first project can't connect to MySQL

2012-10-04 Thread Afshin Mehrabani
Hey Kevin,

Thanks for your correct reply, I had this problem also but after changing 
host from "localhost" to "127.0.0.1" problem solved, But why? what's the 
different between 'localhost' and '127.0.0.1'? 

On Wednesday, February 4, 2009 9:15:32 PM UTC+3:30, Kevin Audleman wrote:
>
> I found the solution in the archives: I changed DATABASE_HOST to 
> 127.0.0.1 from '' 
>
> Kevin 
>
> On Feb 4, 9:41 am, Kevin Audleman  wrote: 
> > Hello everyone, 
> > 
> > I am running through the tutorial and setting up my first django 
> > project. Quite exciting! However I have run into trouble connecting to 
> > MySQL. My settings.py file looks like this: 
> > 
> > DATABASE_ENGINE = 'mysql'   # 'postgresql_psycopg2', 
> > 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 
> > DATABASE_NAME = 'test' # Or path to database file if using 
> > sqlite3. 
> > DATABASE_USER = 'root' # Not used with sqlite3. 
> > DATABASE_PASSWORD = '' # Not used with sqlite3. 
> > DATABASE_HOST = '' # Set to empty string for localhost. 
> > Not used with sqlite3. 
> > DATABASE_PORT = '' # Set to empty string for default. Not 
> > used with sqlite3. 
> > 
> > Yes, the username is 'root' and there is no password. This is on my 
> > local machine (OS X 10.5) so it doesn't matter. 
> > 
> > When I run... 
> > 
> > $ python manage.py syncdb 
> > 
> > I get the following... 
> > 
> > Traceback (most recent call last): 
> >   File "manage.py", line 11, in  
> > execute_manager(settings) 
> >   File "/Library/Python/2.5/site-packages/django/core/management/ 
> > __init__.py", line 340, in execute_manager 
> > utility.execute() 
> >   File "/Library/Python/2.5/site-packages/django/core/management/ 
> > __init__.py", line 295, in execute 
> > self.fetch_command(subcommand).run_from_argv(self.argv) 
> >   File "/Library/Python/2.5/site-packages/django/core/management/ 
> > base.py", line 192, in run_from_argv 
> > self.execute(*args, **options.__dict__) 
> >   File "/Library/Python/2.5/site-packages/django/core/management/ 
> > base.py", line 218, in execute 
> > self.validate() 
> >   File "/Library/Python/2.5/site-packages/django/core/management/ 
> > base.py", line 246, in validate 
> > num_errors = get_validation_errors(s, app) 
> >   File "/Library/Python/2.5/site-packages/django/core/management/ 
> > validation.py", line 65, in get_validation_errors 
> > connection.validation.validate_field(e, opts, f) 
> >   File "/Library/Python/2.5/site-packages/django/db/backends/mysql/ 
> > validation.py", line 8, in validate_field 
> > db_version = connection.get_server_version() 
> >   File "/Library/Python/2.5/site-packages/django/db/backends/mysql/ 
> > base.py", line 277, in get_server_version 
> > self.cursor() 
> >   File "/Library/Python/2.5/site-packages/django/db/backends/ 
> > __init__.py", line 56, in cursor 
> > cursor = self._cursor(settings) 
> >   File "/Library/Python/2.5/site-packages/django/db/backends/mysql/ 
> > base.py", line 262, in _cursor 
> > self.connection = Database.connect(**kwargs) 
> >   File "/Users/audleman/django_projects/pollster/__init__.py", line 
> > 74, in Connect 
> > 
> >   File "/Library/Python/2.5/site-packages/MySQL_python-1.2.2-py2.5- 
> > macosx-10.5-i386.egg/MySQLdb/connections.py", line 170, in __init__ 
> > _mysql_exceptions.OperationalError: (2002, "Can't connect to local 
> > MySQL server through socket '/tmp/mysql.sock' (2)") 
> > 
> > I'm not exactly sure what this socket is or why django can't find it. 
> > One thought is that I installed LAMP on my machine using XAMPP, which 
> > puts everything in the /Applications/xampp directory. Poking around, I 
> > managed to find a mysql.sock file here: 
> > 
> > /Applications/xampp/xamppfiles/var/mysql/mysql.sock 
> > 
> > Assuming this is the correct socket, how do I tell django where to 
> > find it? 
> > 
> > Thanks, 
> > Kevin

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/0dD75LGNe6UJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Newbie question: first project can't connect to MySQL

2009-02-04 Thread Kevin Audleman

I found the solution in the archives: I changed DATABASE_HOST to
127.0.0.1 from ''

Kevin

On Feb 4, 9:41 am, Kevin Audleman  wrote:
> Hello everyone,
>
> I am running through the tutorial and setting up my first django
> project. Quite exciting! However I have run into trouble connecting to
> MySQL. My settings.py file looks like this:
>
> DATABASE_ENGINE = 'mysql'           # 'postgresql_psycopg2',
> 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
> DATABASE_NAME = 'test'             # Or path to database file if using
> sqlite3.
> DATABASE_USER = 'root'             # Not used with sqlite3.
> DATABASE_PASSWORD = ''         # Not used with sqlite3.
> DATABASE_HOST = ''             # Set to empty string for localhost.
> Not used with sqlite3.
> DATABASE_PORT = ''             # Set to empty string for default. Not
> used with sqlite3.
>
> Yes, the username is 'root' and there is no password. This is on my
> local machine (OS X 10.5) so it doesn't matter.
>
> When I run...
>
> $ python manage.py syncdb
>
> I get the following...
>
> Traceback (most recent call last):
>   File "manage.py", line 11, in 
>     execute_manager(settings)
>   File "/Library/Python/2.5/site-packages/django/core/management/
> __init__.py", line 340, in execute_manager
>     utility.execute()
>   File "/Library/Python/2.5/site-packages/django/core/management/
> __init__.py", line 295, in execute
>     self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "/Library/Python/2.5/site-packages/django/core/management/
> base.py", line 192, in run_from_argv
>     self.execute(*args, **options.__dict__)
>   File "/Library/Python/2.5/site-packages/django/core/management/
> base.py", line 218, in execute
>     self.validate()
>   File "/Library/Python/2.5/site-packages/django/core/management/
> base.py", line 246, in validate
>     num_errors = get_validation_errors(s, app)
>   File "/Library/Python/2.5/site-packages/django/core/management/
> validation.py", line 65, in get_validation_errors
>     connection.validation.validate_field(e, opts, f)
>   File "/Library/Python/2.5/site-packages/django/db/backends/mysql/
> validation.py", line 8, in validate_field
>     db_version = connection.get_server_version()
>   File "/Library/Python/2.5/site-packages/django/db/backends/mysql/
> base.py", line 277, in get_server_version
>     self.cursor()
>   File "/Library/Python/2.5/site-packages/django/db/backends/
> __init__.py", line 56, in cursor
>     cursor = self._cursor(settings)
>   File "/Library/Python/2.5/site-packages/django/db/backends/mysql/
> base.py", line 262, in _cursor
>     self.connection = Database.connect(**kwargs)
>   File "/Users/audleman/django_projects/pollster/__init__.py", line
> 74, in Connect
>
>   File "/Library/Python/2.5/site-packages/MySQL_python-1.2.2-py2.5-
> macosx-10.5-i386.egg/MySQLdb/connections.py", line 170, in __init__
> _mysql_exceptions.OperationalError: (2002, "Can't connect to local
> MySQL server through socket '/tmp/mysql.sock' (2)")
>
> I'm not exactly sure what this socket is or why django can't find it.
> One thought is that I installed LAMP on my machine using XAMPP, which
> puts everything in the /Applications/xampp directory. Poking around, I
> managed to find a mysql.sock file here:
>
> /Applications/xampp/xamppfiles/var/mysql/mysql.sock
>
> Assuming this is the correct socket, how do I tell django where to
> find it?
>
> Thanks,
> Kevin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Newbie question: first project can't connect to MySQL

2009-02-04 Thread Kevin Audleman

Hello everyone,

I am running through the tutorial and setting up my first django
project. Quite exciting! However I have run into trouble connecting to
MySQL. My settings.py file looks like this:

DATABASE_ENGINE = 'mysql'   # 'postgresql_psycopg2',
'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'test' # Or path to database file if using
sqlite3.
DATABASE_USER = 'root' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost.
Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not
used with sqlite3.

Yes, the username is 'root' and there is no password. This is on my
local machine (OS X 10.5) so it doesn't matter.

When I run...

$ python manage.py syncdb

I get the following...

Traceback (most recent call last):
  File "manage.py", line 11, in 
execute_manager(settings)
  File "/Library/Python/2.5/site-packages/django/core/management/
__init__.py", line 340, in execute_manager
utility.execute()
  File "/Library/Python/2.5/site-packages/django/core/management/
__init__.py", line 295, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Python/2.5/site-packages/django/core/management/
base.py", line 192, in run_from_argv
self.execute(*args, **options.__dict__)
  File "/Library/Python/2.5/site-packages/django/core/management/
base.py", line 218, in execute
self.validate()
  File "/Library/Python/2.5/site-packages/django/core/management/
base.py", line 246, in validate
num_errors = get_validation_errors(s, app)
  File "/Library/Python/2.5/site-packages/django/core/management/
validation.py", line 65, in get_validation_errors
connection.validation.validate_field(e, opts, f)
  File "/Library/Python/2.5/site-packages/django/db/backends/mysql/
validation.py", line 8, in validate_field
db_version = connection.get_server_version()
  File "/Library/Python/2.5/site-packages/django/db/backends/mysql/
base.py", line 277, in get_server_version
self.cursor()
  File "/Library/Python/2.5/site-packages/django/db/backends/
__init__.py", line 56, in cursor
cursor = self._cursor(settings)
  File "/Library/Python/2.5/site-packages/django/db/backends/mysql/
base.py", line 262, in _cursor
self.connection = Database.connect(**kwargs)
  File "/Users/audleman/django_projects/pollster/__init__.py", line
74, in Connect

  File "/Library/Python/2.5/site-packages/MySQL_python-1.2.2-py2.5-
macosx-10.5-i386.egg/MySQLdb/connections.py", line 170, in __init__
_mysql_exceptions.OperationalError: (2002, "Can't connect to local
MySQL server through socket '/tmp/mysql.sock' (2)")


I'm not exactly sure what this socket is or why django can't find it.
One thought is that I installed LAMP on my machine using XAMPP, which
puts everything in the /Applications/xampp directory. Poking around, I
managed to find a mysql.sock file here:

/Applications/xampp/xamppfiles/var/mysql/mysql.sock

Assuming this is the correct socket, how do I tell django where to
find it?

Thanks,
Kevin

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---