Django 2.0 and MySql

조회수 189회
읽지 않은 첫 메시지로 건너뛰기

Alan

읽지 않음,
2017. 12. 18. 오후 1:18:4617. 12. 18.
받는사람 django...@googlegroups.com
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

Julio Biason

읽지 않음,
2017. 12. 18. 오후 1:58:4217. 12. 18.
받는사람 django...@googlegroups.com
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).

--
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...@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

Alan

읽지 않음,
2017. 12. 18. 오후 7:06:5017. 12. 18.
받는사람 django...@googlegroups.com
Thanks Julio,

I realised my mistake, mixing anaconda with vanilla ubuntu was not a good mix and then I removed the /tmp line.

Best regards,

Alan


For more options, visit https://groups.google.com/d/optout.



--
전체답장
작성자에게 답글
전달
새 메시지 0개