Monday, December 18, 2017

Re: Django 2.0 and MySql

Are you sure the socket is being created on /tmp? Because that's what the error is pointing our: You said Django should communicate with MySQL though a socket file in /tmp called "mysql.sock", but there was some problem with it. You should probably check your MySQL config file (/etc/my.cnf) to assure the socket is being created there.

(On my local install, the socket is in /var/lib/mysql, so you probably just update your settings).

On Mon, Dec 18, 2017 at 4:13 PM, Alan <alanwilter@gmail.com> wrote:
I am trying this in a VM with ubuntu 16.04:

bash Miniconda3-latest-Linux-x86_64.sh
sudo apt-get install rabbitmq-server
sudo systemctl start rabbitmq-server
pip install Django celery PyMySQL
sudo apt-get install mysql-server
mysql_secure_installation
mysql -u root -p
mysql> CREATE USER 'acpype_mysql'@'localhost' IDENTIFIED BY '_bla_bla_';
mysql> GRANT ALL PRIVILEGES ON * . * TO 'acpype_mysql'@'localhost';
conda install -c bioconda mysqlclient

And once I have copied my django project, I try:

python manage.py makemigrations

which will fail with:

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

from my settings.py

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'acpype_db',
        'USER': 'acpype_mysql',
        'PASSWORD': '_bla_bla_',
        'HOST': 'localhost',
        'PORT': '',
        'HOST': '/tmp/mysql.sock',
    }
}

Many thanks in advance,

Alan
--
I'll cycle across Britain in 2018 for a charity, would you consider
Many thanks!
--
Alan Wilter SOUSA da SILVA, DSc
Senior Bioinformatician, UniProt
European Bioinformatics Institute (EMBL-EBI)
European Molecular Biology Laboratory
Wellcome Trust Genome Campus
Hinxton
Cambridge CB10 1SD
United Kingdom

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEznbzm7J8mq-f9n%2BqStPYSqgii1NxgiXTgdN1s56d0vLNaAQw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



--
Julio Biason, Sofware Engineer
AZION  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101  |  Mobile: +55 51 99907 0554

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEM7gE3Hqavjr%2BV_bk-Nf3DkSZq%2Bu7gSnymt7HuG%2BvyVDSCJEQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment