Sqlacodegen - unable to connect to database
I am trying to use sqlacodegen
on mine database
.
sqlacodegen mysql://root:mypassword@localhost/database_name
However, I keep getting this error:
sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")
However, in my application, flask
I am accessing this same database
without issue.
This file doesn't exist on my system, so I went to /etc/mysql/my.cnf
and changed the line:
socket = /var/run/mysqld/mysqld.sock
to
socket = /opt/lampp/var/mysql/mysql.sock
Not really sure if this was the right thing to do. However, even after this change, the systems seem to still be trying to launch from their original location.
+3
user2268507
source
to share