Mysql external acces not working - mysql

I have a setup of two separate Servers.
On one, there is the Website with its DB and on the other Server there is a DB the website needs to access.
so... both servers are running newest versions of Mysql and pma.
By default if i create a new Database with a user, there is a user with localhost access and one with "%" access being created.
As far as i knew the % means that it can be accessed from anywhere... so why isnt it working?
Pic of pma users: PIC
Pic of error message on the Website:PIC

Set bind-address to 0.0.0.0 in my.cnf and don't forget to restrict access with iptables ;)

Related

Connecting to a remote mySql server from my local machine

My main problem right now is that I can't connect to the remote mysql server while developing on my machine. I'm trying to update a website that was previously developed by someone I do not know. I've been editing the site on my local machine but I need to access data from the mysql database that it has been using. I have the username and password that the site uses to connect to the mysql server. I can connect to it through phpmyadmin but I would like to work locally without publishing my edits to the server.
I found this here in SO and I tried running the scripts in phpmyadmin using my pc's IPaddress but I keep getting
Access denied for user 'username'#'localhost' (using password: YES)
even though I'm 100% sure I'm using the password that I used to login to phpmyadmin. I tried creating a new user but the login I'm using doesn't seem to have a Create User privilege either.
I understand that the previous developer might have a different "admin" account that has all the privileges but I have no way of knowing either.
I am a C# developer but I'm really new to MySql. Any help is greatly appreciated.
This may be a firewall issue. phpmyadmin listens on port 80 by default, but mySQL listens on port 3306. Please check the firewalls on your local PC (to make sure you can get out on 3306) and the server (to make sure you can get in on 3306).

How to access my newly setup MySQL database (getting "Domain is currently unable to handle this request.")

I just set up a new MySQL database with the MySQL workbench & created a user for it with all necessary privileges. I am using this database for use with my php code. But I can't seem to connect to it on my live server (pages are hosted on windows server 2012). Everything works fine in my local environment with xampp and the new MySQL database is exactly the same as the xampp one. I think I am maybe using the wrong host name or something. As host name I copied the name that is displayed after "Host:" when you click on Server Status in MySQL workbench. The database name, user & password should all be correct. But when my code tries to access the db I get a "The domain page isn’t working. Domain is currently unable to handle this request."
You either have no network connection to the server at all or it is blocked due to firewall or routing misconfiguration.
If you do have network access in general, you might forgot to
FLUSH PRIVILEGES;
or you have not enabled networking over TCP, the default is to listen only to localhost (on unix systems via unix sockets, on microsoft I guess it's simply TCP).
Read about the following configuration parameter which will solve your networking issue:
bind-address
If you have a very old MySQL server version, the parameter is enable-networking but it shouldn't be the case anymore.

Unable to connect to local MySQL DB using Laravel

I have a local database that I can connect to no problem using straight php
However, when I use the same settings in Laravel, I get an access denied error message
I checked stackoverflow for this type of error and most cases is solved by using 127.0.0.1. I made sure to try both 127.0.0.1 and localhost whenever asked for host/server.
Also, I made sure root had sufficient privileges
Here are my configuration settings, I tried to use different accounts, other than root, and also changing 127.0.0.1 to localhost (and the opposite)
database.php file
.env file
Hoping to learn this framework, I've heard great things. Appreciate any help
Sounds like you are trying the connection both with the script and laravel from a different Server like homestead.
Normally there are restrictions that you can't connect from remote (i.e. from a VM like homestead) to a certain server (i.e. localhost) with the root user.
Possible Solutions:
1. Create another user with the relevant permissions on mysql and connect with that one.
2. Look in the web for how to allow remote connections
3. Go the laravel way and use the homestead DB inside of the VM
First, are you sure you typed the password correctly?
Second, are you using the homestead virtual box? If yes, the default user is "homestead" and the pass is "secret" without quotes of course. Try putting that in the .env file

Cannot establish remote mysql connection

I recently moved a few websites of mine from one hosting to another, but I decided to keep databases on the old hosting.
I did all the steps:
whitelisted new server's IP
changed all dbcon config ''localhost'' to old server IP
even changed outdated ''mysql_connect'' with mysqli
Still I cannot establish db connection at all!
How do I troubleshoot this? I have bno idea where else to look!
There might be some issues with PHP in the new hosting!
In PHP settings, the dropdown menu of ''Select PHP version" has only WARNING:Alternatives and ERROR:User options. Shouldn't there be PHP versions???
You may have to look at the MySQL user connections from within MySQL.
Here is what you do:
SELECT user,host FROM mysql.user;
This will reveal where each MySQL user can connection from.
If a user has host='%', then that user can connect from anywhere.
If a user has host='10.20.30.%', then that user can connect from '10.20.30.%' netblock only.
Let's take the latter case: a specific netblock.
Suppose your new servers are on netblock 20.30.40.%. You may have to go to each user and change the netblock in mysql.user.
EXAMPLE: For the user myuser.'10.20.30.%', and you want to change myuser to access MySQL from netblock 20.30.40.%, you would login to the DB server, connect to mysql as root#localhost, and execute this:
UPDATE mysql.user SET host='20.30.40.%' WHERE host='10.20.30.%';
FLUSH PRIVILEGES;
This will update every user's host column with the new netblock.
You could always use the GRANT command instead of hacking it like I just suggested.
If you cannot change mysql.user in either way, you may have to ask the DB Host provider to do that for you.
Give it a Try !!!

Plesk not creating a New Database Server

I have a windows server where Plesk is installed with php & mySQL by default (from Hosting Provider). When I first got the server I remember I removed mySQL from Control Panel since I didn't need it, but after like one year, I came to a point where I have to create a Wordpress website, and therefore I am needing mySQL again.
Note also that there's two mySQL, one for Plesk (which I didn't uninstall), and another one for our databases (which I uninstalled long ago, but reinstalled later).
I went to Plesk under Database Servers, and I can see there's no Database Servers there... Then I try to Add Database Server with the following settings:
Hostname: localhost
Port: 3306
With Admin Username & Password...
But I am getting the following error:
Error: A database server with this combination of host address and port number is already registered.
Please note that this is surely different from the mySQL settings for Plesk since the port is different.
Do you guys have any idea how to resolve this issue? I've been stuck since a few days...
I appreciate your help guys that's urgent!
Thanks.
Looks like inconsistency in plesk database "psa" related to entity of database servers.
Most easy workaround it's to register new database server not as "localhost", but as "127.0.0.1" or some other name which can be resolved to localhost or other port.
Another workaround it's to look into psa database via "%plesk_bin%\dbclient.exe" --direct-sql --sql="select * from databaseservers".