• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.

N00b Question: Super Simple MYSQL Question (Please HELP!)

T

TylorFamous

Guest
(thanks for reading this!)

Ok, I have only done some really simple MYSQL stuff with php. I was using a mysql db that came with a domain name I got through godaddy and just some simple PHP. And to connect to my database I would need a user name, password, host and database name.

Now my question where do i find the host name with the MYSQL db's that I make in PLESK? Is it my ipaddress? Because in the past the host name was something like 123.343.45.34.securerver.net or something like that.

Please give me any info. That would be awesome! Thanks :)
 
Nope that didn't work :(

Error:

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'DOMAINNAME'@'SERVERNAME.prod.phx3.secureserver.net' (using password: YES) in C:\Inetpub\vhosts\DOMAINNAME.com\httpdocs\test\dbtest.php on line 6
Error connecting to mysql
 
oh, hmm okay. I guess the MySQL server is remote? Is it on the same box or a different machine? Is SERVERNAME.prod.phx3.secureserver.net your Plesk server?
 
Like I said I am kind of new so I don't know what you mean by remote...? I made the server by going to:

Domains > www.DOMAINNAME.com > Databases > Add New Database > (and then i enter the info)

Here is the php code I am using, if that helps:
<?php
$dbhost = 'localhost';
$dbuser = 'USERNAME';
$dbpass = 'PASSWORD';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'TABLENAME';
mysql_select_db($dbname);
?>

And here is the Error I get with that code:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'domainname'@'localhost' (using password: YES) in C:\Inetpub\vhosts\domainname\httpdocs\test\dbtest.php on line 6
Error connecting to mysql

(The error I posted before was what I got when I used my server's IPAddress, sorry about that)
 
Let's take a few steps back. Did you setup a user on your database after you created the database?
 
Yes I did create a user. And I didn't even think about using those logins. Is this the login name/password I should use?

Well I tried it and I no longer get any MYSQL errors (which i think is a good thing!) but I also don't get any information when I try to get it. I do though, get a error that I think is just from my PHP code.

Error: No database selected with query SELECT * FROM `shows` WHERE `showid` =1

Here is my PHP Code.
<?php
$dbhost = 'localhost';
$dbuser = 'USERLogin';
$dbpass = 'USERPASS';

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');

$dbname = 'shows';
mysql_select_db($dbname);

$query = "SELECT * FROM `shows` WHERE `showid` =1";
$result = mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query);
$row = mysql_fetch_array($result);
extract($row);

echo "This show is:";
echo $showname;
?>

Thank you for all your help though!
 
Ok, my last problem was because I didn't have a database name in my code. But I am so happy to say that everything is working PERFECTLY and I can't thank you enough! You truly have saved more pulled out hair than you can possibly imagine!!!

Thanks!
 
Back
Top