Discussion:
Databases configuration
Cool Smith
2018-12-06 11:46:34 UTC
Permalink
Hi everyone,

I am new to Django. I have started a new project running on my localhost.
Rather than using the default sqlite database, I changed it to mysql with
the following settings on MacOS High Sierra v13.10.6:

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mysql',
'USER': 'root',
'PASSWORD': 'root',
'HOST': '',
'PORT': '5432'
}
}

Enter code here...

When I run the server using the
python manage.py runserver

command, I get an error:
django.db.utils.OperationalError: (2002, "Can't connect to local MySQL
server through socket '/tmp/mysql.sock' (2)")

Does anyone know the cause of this error and tell me how to fix it? Thank
you in advance.
--
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+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f1386271-01f7-4909-887a-f7efa008bcef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
C. Kirby
2018-12-06 14:38:09 UTC
Permalink
Did you start your mysql process?
Post by Cool Smith
Hi everyone,
I am new to Django. I have started a new project running on my localhost.
Rather than using the default sqlite database, I changed it to mysql with
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mysql',
'USER': 'root',
'PASSWORD': 'root',
'HOST': '',
'PORT': '5432'
}
}
Enter code here...
When I run the server using the
python manage.py runserver
django.db.utils.OperationalError: (2002, "Can't connect to local MySQL
server through socket '/tmp/mysql.sock' (2)")
Does anyone know the cause of this error and tell me how to fix it? Thank
you in advance.
--
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+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/693cde12-e701-4f4f-8b51-4938fd0f427b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Arnaldo Díaz Molina
2018-12-06 15:15:04 UTC
Permalink
Did you have installed the mysql driver??? Is your host localhost???
Did you have your mysql service started???
Post by C. Kirby
Did you start your mysql process?
Post by Cool Smith
Hi everyone,
I am new to Django. I have started a new project running on my localhost.
Rather than using the default sqlite database, I changed it to mysql with
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mysql',
'USER': 'root',
'PASSWORD': 'root',
'HOST': '',
'PORT': '5432'
}
}
Enter code here...
When I run the server using the
python manage.py runserver
django.db.utils.OperationalError: (2002, "Can't connect to local MySQL
server through socket '/tmp/mysql.sock' (2)")
Does anyone know the cause of this error and tell me how to fix it? Thank
you in advance.
--
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
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/693cde12-e701-4f4f-8b51-4938fd0f427b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CANP6BOxjsAQ0ji58JqEmXNi5KrcQ3FyzB_hCX3qWdwqc8pw88Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Cool Smith
2018-12-07 09:09:28 UTC
Permalink
How to do so?
Post by C. Kirby
Did you start your mysql process?
Post by Cool Smith
Hi everyone,
I am new to Django. I have started a new project running on my localhost.
Rather than using the default sqlite database, I changed it to mysql with
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mysql',
'USER': 'root',
'PASSWORD': 'root',
'HOST': '',
'PORT': '5432'
}
}
Enter code here...
When I run the server using the
python manage.py runserver
django.db.utils.OperationalError: (2002, "Can't connect to local MySQL
server through socket '/tmp/mysql.sock' (2)")
Does anyone know the cause of this error and tell me how to fix it? Thank
you in advance.
--
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+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a8b15f7a-ec01-418c-9cab-35321ba18cfd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Cool Smith
2018-12-07 09:11:00 UTC
Permalink
I tried starting MYSQL server on System Preferences. However, it seems the
server will shutdown automatically a few seconds later.
Post by Cool Smith
How to do so?
Post by C. Kirby
Did you start your mysql process?
Post by Cool Smith
Hi everyone,
I am new to Django. I have started a new project running on my
localhost. Rather than using the default sqlite database, I changed it to
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mysql',
'USER': 'root',
'PASSWORD': 'root',
'HOST': '',
'PORT': '5432'
}
}
Enter code here...
When I run the server using the
python manage.py runserver
django.db.utils.OperationalError: (2002, "Can't connect to local MySQL
server through socket '/tmp/mysql.sock' (2)")
Does anyone know the cause of this error and tell me how to fix it?
Thank you in advance.
--
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+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3a69cf5d-101d-4653-87ba-f89c1b2ae956%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Kasper Laudrup
2018-12-07 09:22:09 UTC
Permalink
Hi Cool Smith,
Post by Cool Smith
I tried starting MYSQL server on System Preferences. However, it seems
the server will shutdown automatically a few seconds later.
You would probably have a better chance of getting useful responses if
you posted your question in a forum related to running MySQL on Mac OSX.

Maybe here:

https://forums.mysql.com/

Figuring out how to run processes on Mac OSX is not really related to
using Django.

Kind regards,

Kasper Laudrup
--
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+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/671b1952-cd26-bc3e-7549-d75fd7a5d79e%40stacktrace.dk.
For more options, visit https://groups.google.com/d/optout.
Chuck R
2018-12-07 10:23:18 UTC
Permalink
Hi, if you're using python venv, try install mysqlclient(pip install
mysqlclient) and rerun the local server.
Post by C. Kirby
Did you start your mysql process?
Post by Cool Smith
Hi everyone,
I am new to Django. I have started a new project running on my localhost.
Rather than using the default sqlite database, I changed it to mysql with
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mysql',
'USER': 'root',
'PASSWORD': 'root',
'HOST': '',
'PORT': '5432'
}
}
Enter code here...
When I run the server using the
python manage.py runserver
django.db.utils.OperationalError: (2002, "Can't connect to local MySQL
server through socket '/tmp/mysql.sock' (2)")
Does anyone know the cause of this error and tell me how to fix it? Thank
you in advance.
--
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
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/693cde12-e701-4f4f-8b51-4938fd0f427b%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/693cde12-e701-4f4f-8b51-4938fd0f427b%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAAcYvkzqXECiQAE1QokbADeCqHdgn6Uk0Wq8UpTWjnt%2BoWKyhQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Daniel M
2018-12-07 14:43:45 UTC
Permalink
I think the problem is the server. Try pip install mysqlserver then start
the server.
Post by Chuck R
Hi, if you're using python venv, try install mysqlclient(pip install
mysqlclient) and rerun the local server.
Post by C. Kirby
Did you start your mysql process?
Post by Cool Smith
Hi everyone,
I am new to Django. I have started a new project running on my
localhost. Rather than using the default sqlite database, I changed it to
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mysql',
'USER': 'root',
'PASSWORD': 'root',
'HOST': '',
'PORT': '5432'
}
}
Enter code here...
When I run the server using the
python manage.py runserver
django.db.utils.OperationalError: (2002, "Can't connect to local MySQL
server through socket '/tmp/mysql.sock' (2)")
Does anyone know the cause of this error and tell me how to fix it?
Thank you in advance.
--
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
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/
msgid/django-users/693cde12-e701-4f4f-8b51-4938fd0f427b%
40googlegroups.com
<https://groups.google.com/d/msgid/django-users/693cde12-e701-4f4f-8b51-4938fd0f427b%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/
msgid/django-users/CAAcYvkzqXECiQAE1QokbADeCqHdgn6Uk0Wq8UpTWjnt%2BoWKyhQ%
40mail.gmail.com
<https://groups.google.com/d/msgid/django-users/CAAcYvkzqXECiQAE1QokbADeCqHdgn6Uk0Wq8UpTWjnt%2BoWKyhQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEEZZ8K2ZmppFCx4ByT6HTgcKL5u%2BKrTi5kg9xQCT%2B%3DqkxbOrw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Chuck R
2018-12-07 14:23:28 UTC
Permalink
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mysql',
'USER': 'root',
'PASSWORD': 'root',
'HOST': '',
'PORT': '3306'
}
}

This should work for you. You were using the wrong port.The port you were using is for postgresql.You maybe prompted to install mysqlclient. Use pip install mysqlclient.
--
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+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ce27245a-24a5-45b2-af68-15afe08e61d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Loading...