First, allow me to begin by saying the web site was working perfectly well on Dreamhost (except going back week with horrible lags and down time - but it wasn't what helped me get off them, read below).
I had been hosting my website on Dreamhost. I needed to move because of an issue with who owns the revenue hosting (he'd not allow me to change a dns config about the panel nor would get it done for me personally). And So I signed with HostGator, and today I am tied to this MySQL problem. Some tips about what I have done to date:
First, I submitted all of the files via ftp towards the HostGator server. Then, I released the database in the old server and imported it to the brand new one. I Quickly transformed the title server about the domain registrar, and lastly, before long, hit F5 about the browser.
After which there is an enormous ammount of error lines. And So I looked the HostGator Support Portal and discovered which i needed to vary from this (the code I had been using before):
<? date_default_timezone_set('America/Sao_paulo') if ($_SERVER['HTTP_HOST']=='localhost') choose_db("tablename") else choose_db("mydatabasename") mysql_query("SET time_zone='-3:00'") ?>
To something similar to this:
<? define('DB_NAME', 'mydatabasename') define('DB_USER', 'mylogin') define('DB_PASSWORD', 'mypassword') define('DB_HOST', 'localhost') ?>
The truth is I am no PHP or MySQL expert. The programmer allow me to without support, so I am by myself.
After I attempt to load my website, it provides the following errors:
Warning: mysql_query() [function.mysql-query]: Access refused for user 'mylogin'@'localhost' (using password: NO) in /home/mylogin/public_html/index.php online 42 Warning: mysql_query() [function.mysql-query]: A hyperlink towards the server couldn't be established in /home/mylogin/public_html/index.php online 42 ERROR 40 >Access refused for user 'mylogin'@'localhost' (using password: NO)
About the file index.php, line 42 is:
$sqlo = mysql_query("choose *, max-purchasers as left from offers inner join rel_city on rel_city.id_offer = offers.id where id_city=$city and startdate <= now() and enddate >= now() order by priority desc, left desc, enddate asc") or die("ERROR 40 >".mysql_error())
One important detail is the fact that I want both of these lines to utilize the brand new hosting, but whenever I attempt to place them, it gives new errors:
date_default_timezone_set('America/Sao_paulo') mysql_query("SET time_zone='-3:00'")
Any ideas of generate an income could possibly get this working?
<? date_default_timezone_set('America/Sao_paulo') $conexao = mysql_connect("localhost","mylogin","mypassword") $bd = mysql_choose_db("mydatabasename") mysql_query("SET time_zone='-3:00'") ?>
What I have done is simplify the initial code to get rid of the IF / ELSE statement which appears like it may be there for development reasons.
If you are getting other errors not published, please include them.
I am unfamiliar with HostGator's setup, but what appears to become the problem is either the address or qualifications you are attempting to gain access to the server with.
Possibly HostGator prepends a prefix to usernames and database names? (ex. maybe it ought to be something_mydatabasename instead of simply mydatabasename)
Or possibly their setup does not support using localhost because the database address possibly there is a defined and isolated address that you should connect with.
I'd give support a shout, or double-look into the addresses, usernames, and database names inside your cPanel configurations. It could give you an excellent start.
(These tips is, obviously, presuming you have the password for that database correct, that the error indicates isn't the situation.)
In the errors, it's like you do not have the DB user and password setup in MySQL.
Your database includes a password. Make certain you have specified them properly, or else you will not have the ability to connect with your database.
The mistake messages you are seeing are because of your programmer while using PHP
die() function, which is not great practice.
Seek advice from your host and make certain you have permissions in your tables, too. You need to, but who knows.