I have setup a simple web service, when using just the python3 manage.py runserver it works fine, but when I deploy the application to Apache by using mod_wsgi it give the following error:
(2003, "Can't connect to MySQL server on 'localhost' ([Errno 13] Permission denied)")
I have also tried using the server's name and then the server's ip and it just replaces localhost in the error message.
Here is a copy of the XML when navigating to the page: http://pastebin.com/QtRzi0X6
Edit:
Also I would like to add that I am running on Fedora 20, Python3, Django 1.6, and MariaDB, Also I am use PyMySQL for django and python 3 so it can connect to MySQL
As it turns out (After hours of searching and testing), this is actually a apache/mod_wsgi problem, just type the following command to allow apache to make database connections:
setsebool -P httpd_can_network_connect_db 1
Related
Error Message is:
Warning: mysqli::__construct(): (HY000/1130): Host 'host.docker.internal' is not allowed to connect to this MySQL server in E:\wamp64\www\FISH\test13\records.php on line 61
Error failed to connect to MySQL: Host 'host.docker.internal' is not allowed to connect to this MySQL server
On Windows 10, using VSCode, wamp, localhost, mysql
Was working fine, then I installed Docker Desktop on Windows
Was having trouble understanding Docker, so I uninstalled it from Control Panel ->Programs and Features.
Now when I return to localhost website, I get the error message (as above).
I have additionally removed any reference to 'docker' using regedit.
I removed all files 'docker' from file system.
Rebooted.
root user has full access to database as confirmed in:
Server: MySQL:3306 »Database: mysql »Table: user“Users and global privileges”
Any ideas how to remove error message and get system working again? Or do something to just move on from this error?
I upgraded mysql from 5.7 to 8.0 and started encountering this error which is preventing my app from connecting to the database.
django.db.utils.OperationalError: (2026, 'SSL connection error: unknown error number')
I have my own ca.pem server-cert.pem server-key.pem which mysql uses. The django app properly sets the ca cert in settings. Everything works in 5.7.
I had this issue when running ‘python manage.py showmigrations’ from my Django project to a remote MySQL server. I’m using Django 3.1.7 and MySQL 8.0.
The below steps worked in my case:
Install PyMySql
In init.py (under the same directory as settings.py), add the following code:
import pymysql
pymysql.install_as_MySQLdb()
Try upgrading your django app's OS. I upgraded my docker image base from slim-stretch to slim-buster and the error went away
in your mysql config file, try adding this under mysqld
[mysqld]
default_authentication_plugin=mysql_native_password
Remove ssl from the django database settings (DATABASES['OPTIONS']['ssl']) and see if the error goes away
Getting the above error while connecting to mysql server running on WSL. That's weird
because I have done this with postgresql and it worked fine.
But if on the WSL command prompt I type mysql -u root I am able to connect to it.
The Dbeaver or any other window client application or any java program is also giving error
Starting an SSH tunnel to MySQL so MySQL Workbench can connect to the remote DB using the following command:
ssh -L 3306:localhost:3306 <username>#<domain> -N
MySQL Workbench is able to connect without issue doing this.
I was also trying to spin up a local copy of the Django application and connect to the remote test DB and I get met with:
django.db.utils.OperationalError: (2002, 'Can\'t connect to local MySQL server through socket \'/var/run/mysqld/mysqld.sock\' (2 "No such file or directory")'
Looking at the Django settings, everything looks correct. Just seems like Django is ignoring the tunnel despite using the same port. Django is in virtualenv so wonder if something there might be causing it.
Any suggestions?
I had to change the DB connection string in the settings.py to 127.0.0.1 instead of localhost.
I am running an AWS RDS. I used to be able to connect to it via MySQL workbench, and my EC2 instance running a laravel application was also connected to it which has been working fine so far but I had an issue with my storage space and needed to download and upload some files on my ec2 instance just to free up some space.
Because I was connecting using as Filezilla I had to use the command sudo usermod -a -G www-data ubuntu to give ubuntu to the group so i can have access to read and write.
The problem is after running this command i noticed I can no longer connect my workbench to the RDS again. Even my laravel application can't access the RDS again.
My Laravel app throws this error
php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution
while workbench throws this
Your connection attempt failed for user ....
How can i resolve this?
I had a similar problem, I restarted my BD RDS