Trying to use planetscale for my db platform for a Django app that i am building. However i'm running into some errors
django.db.utils.OperationalError: (2026, "SSL connection error: no valid certificates were found, CAFile='*************', CAPath=''. One or more of the parameters passed to the function was invalid. Error 2148074333/0x8009035D")
The configuration was copied straight from planetscale
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': env('DB_NAME'),
'HOST': env('DB_HOST'),
'PORT': env('DB_PORT'),
'USER': env('DB_USER'),
'PASSWORD': env('DB_PASSWORD'),
'OPTIONS': {'ssl': {'ca': env('MYSQL_ATTR_SSL_CA')}}
}
}
Finally got it working.
the value for the OPTIONS key should be {'ssl': {'ssl-ca': env('MYSQL_ATTR_SSL_CA')}}
Related
On migrate step I get such error django.db.utils.OperationalError: ERROR: unsupported startup parameter: options
settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'OPTIONS': {
'options': '-c search_path=public'
},
'NAME': env.str('DB_NAME'),
'USER': env.str('DB_USER'),
'PASSWORD': env.str('DB_PASS'),
'HOST': env.str('DB_HOST'),
'PORT': env.str('DB_PORT'),
'DISABLE_SERVER_SIDE_CURSORS': True,
}
}
(in options parameter I tried to set default schema to public)
Can this error appear because I have pgbouncer?
How do I solve this operational error? I have deployed my Django website and I have some issues with the database connection
my settings.py:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'avc',
'USER': 'postgres',
'PASSWORD': '****',
'HOST': 'localhost',
'PORT':'5432'
}
}
I am using Postgres 10
this is the error database refused the client request,
error
I assume Django needs psycopg2 to connect
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'avc',
'USER': 'postgres',
'PASSWORD': '****',
'HOST': 'localhost',
'PORT':'5432'
}
}
As well check if pg_hba.conf is accepting connections
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
please refer step by the step installation guide by edb
https://www.enterprisedb.com/postgres-tutorials/how-use-postgresql-django
I tried to deploy my application on AWS, but I'm having problems!
First, when trying to put MySQL data in settings.py, a problem appears:
"Unknown MySQL server host 'myapp.us-east-1.rds.amazonaws.com'
I tried with other databases (Postgresql and Oracle) and they worked, but mysql did not.
Does anyone know how to solve? I would be grateful. Gratitude.
Please confirm, your setting file should be like below:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'xxx',
'USER': 'xxx',
'PASSWORD': 'xxx',
'HOST': 'xxx.xxx.us-east-1.rds.amazonaws.com',
'PORT': '3306',
}
}
When I connect to my database with mysql I specify the option --ssl, or else I get the error
SSL connection is required. Please specify SSL options and retry.
I know that with MySQL you can connect with a ssl certificate where you have a copy of the certificate locally. With this approach I know how to move forward with Django, as you can specify the option as described here https://stackoverflow.com/a/12285601/2889451
However, in my case I simply pass the option --ssl, and I don't have a local copy of the certificate.
How can I enable this option in Django?
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': DB_NAME,
'USER': DB_USER,
'PASSWORD': DB_PASSWORD,
'HOST': DB_HOST,
'PORT': '',
}
}
Apparently you can solve it by passing the options as shown below:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': DB_NAME,
'USER': DB_USER,
'PASSWORD': DB_PASSWORD,
'HOST': DB_HOST,
'PORT': '',
'OPTIONS': {'ssl': True},
}
}
I am getting error while giving my IP address and localhost name in PostgreSQL admin, any help would be appreciated.
You can take a look at my PostgreSQL admin image here:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'myproject',
'USER': 'myprojectuser',
'PASSWORD': 'fakepassword',
'HOST': 'localhost',
'PORT': '',
}
}