• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Mysql connect remotely?

G

GeneralSquall

Guest
does anyone know how to connect to mysql on plesk remotely?

i have these in the settings below

$dbhost = 'x.x.x.x:3306';
$dbuser = '[email protected];
$dbpass = 'password';
$dbname = 'database';

and when I try i get this error.

Warning: mysql_connect(): Host 'x.x.x.x'is not allowed to connect to this MySQL server in c:\temp\www\script.inc.php on line 30
Failed to open database!
 
The error you are receiving is a result of your mysql user not having the correct permissions to access mysql from your IP. By default mysql users created through psa only have access to the databse from localhost. If you add an additional user with access to mysql from your IP, you will then be able to make the connection.
 
Originally posted by GeneralSquall Warning: mysql_connect(): Host 'x.x.x.x'is not allowed to connect to this MySQL server in c:\temp\www\script.inc.php on line 30
Failed to open database!

You need to setup the correct permissions on the database user and/or the host privileges.

Have a look at the MySQL documentaion about the permission system:

http://dev.mysql.com/doc/refman/4.1/en/privilege-system.html

and more specific:

http://dev.mysql.com/doc/refman/4.1/en/access-denied.html
 
lvalics... why are you advising this person to buy a product while its a "simple" sql config file question? which can be solved within short notice without buying a product.
 
rvdmeer:

1. If you look for that Power Toys, you will see is totally FREE.
2. If you read between line, you will see that the guy (GeneralSquall) are not very advanced in using PLESK, so probabbly don't have sufficient knowledge to enter in MySQL as ADMIN and anyway usually I do not suggest to anyone to modify advanced things if that person is not an advanced user.

I hope this clarified your concern :)
If you read on posts on forum, you will see how many people use Power Toys (and not only because it's free)
 
Originally posted by lvalics
2. If you read between line, you will see that the guy (GeneralSquall) are not very advanced in using PLESK, so probabbly don't have sufficient knowledge to enter in MySQL as ADMIN and anyway usually I do not suggest to anyone to modify advanced things if that person is not an advanced user.

Hmmmmmmmmm.... If you don't know how to enter phpMyAdmin and change/add the according mysql rules to allow access - how would you know how to access a shell, and make sure how to install PowerToys and go to the Control Panel after that to enter the information about the remote user in your interface?

phpMyAdmin has an execlent interface to setup/grant user-access (acl) on the MySQL system.

:)
 
Guys I have been using Plesk since it's very first release.

unfortunately This was a very first in all my years that one of my staff members actually wanted remote access to monitor his database for personally stuff, I myself have never needed this.

I have tried it in previous version back version 2 of plesk and didn't have to change anything in mysql to do so.

Now I admit that I tried it with the newer plesk version again, never needed to. I do not spend alot of time on the forums as I do not have the time with my business needs as customers flow in hourly.

But rest a sure that I am no newbie and know what I am doing. however I am probably older than most of you in this post and have been doing the business than most of you.

Every now and than I even need to be refreshed. =)
 
GeneralSquall: I still suggest Power Toys, will do from PLESK interface this request.
Or you can install on a domain a phpMyAdmin and enter as admin/adminpass and add to MySQL tabel a new user and a host where this user can enter.
Hope this help.
 
Originally posted by GeneralSquall
But rest a sure that I am no newbie and know what I am doing. however I am probably older than most of you in this post and have been doing the business than most of you.

Every now and than I even need to be refreshed. =)

Hehe, oki, but then you could just have written that :) Your post looked like you diden't know how to use the GRANT / access privelege system in MySQL, so sorry I diden't see your post as intended.

But to answer your question then - no, it's not possible to open external access to MySQL database through Plesk. You have to manually change the MySQL user/host tables - or use a 3rd party tool like phpMyAdmin or PowerToys.

:eek:)
 
Thank you Whistler, It probably would have helped if I woul d have said that, lol Thanks again guys.

Most of the time I don't need help on a subject but when I do I can always relie on my freinds here on the forums.


DRINKS ON ME!
 
For those that may find this thread via a search on the topic... connect to database from remote server, this is what I recently sent to a customer of mine who is on a Plesk 7.5 Windows server.

Localhost is the address for local database connectivity. If you are connecting to a database on the Plesk server from a site off of the server, then you may use the main server IP #.

For example, 111.111.111.111 (Bogus IP for public demo purposes in this forum)

Also, you will need to grant permissions on the database you setup using PHPMyAdmin. An example grant command for MySQL would be...

grant all on dbname.* to dbuser@'%' identified by 'dbpassword'

So, your script on the server would have permissions granted as above allowing connections from the wildcard % meaning any remote IP can connect to your database on the server and your script OFF the server that connects to your database would have to connect to 111.111.111.111 as the database host.


If you have a static IP on the site that you will be connecting remotely FROM, then your command could look like this...

grant all on dbname.* to [email protected] identified by 'dbpassword'

Whereas 155.231.232.232 is a demo IP. You would put the actual remote server IP (the server with the script on it that needs to connect remotely to the database on the Plesk server) in its place in the grant command.

 
Make sure the server firewall is not blocking the mysql port.Make sure the server firewall is not blocking the mysql port.
 
does anyone know how to connect to mysql on plesk remotely?

i have these in the settings below

$dbhost = 'x.x.x.x:3306';
$dbuser = '[email protected];
$dbpass = 'password';
$dbname = 'database';

and when I try i get this error.

Warning: mysql_connect(): Host 'x.x.x.x'is not allowed to connect to this MySQL server in c:\temp\www\script.inc.php on line 30
Failed to open database!


You need to correctly configure the remote access. Here is an example of full code you will need to establish remote mysql connection.


<?php

function getdb(){

$servername = "46.101.5.233"; // put your cloudways server IP here
$username = "qxxfumxxxbd";
$password = "xxxxbQxxmM";
$db = "qxxfumxxxbd";

try {

$conn = mysqli_connect($servername, $username, $password, $db);

//echo "Connected successfully";

}

catch(exception $e)

{

echo "Connection failed: " . $e->getMessage();

}

return $conn;

}
 
Back
Top