Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6000709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:43:57+00:00 2026-05-23T00:43:57+00:00

First, let me start by saying the website was working perfectly well on Dreamhost

  • 0

First, let me start by saying the website was working perfectly well on Dreamhost (except for the last week with horrible lags and downtime – but it was not what made me move away from them, read below).

I was hosting my website on Dreamhost. I had to move due to a problem with the owner of the revenue hosting (he’d not let me change a dns config on the panel nor would do it for me).
So I signed with HostGator, and now I’m stuck with this MySQL issue. Here’s what I’ve done so far:

First, I uploaded all the files via ftp to the HostGator server. Then, I exported the database from the old server and imported it onto the new one. Then I changed the name server on the domain registrar, and finally, after a while, hit F5 on the browser.

And then there was a huge ammount of error lines. So I searched the HostGator Support Portal and found out that I had to change from this (the code I was using before):

<?
date_default_timezone_set('America/Sao_paulo');

if ($_SERVER['HTTP_HOST']=='localhost') {
    $conexao = mysql_connect("localhost");
    $bd = mysql_select_db("tablename");     
} else {
    $conexao = mysql_connect("mysite.phpmyadmin.com","mylogin","mypassword");
    $bd = mysql_select_db("mydatabasename");
}
mysql_query("SET time_zone='-3:00'");
?>

To something like this:

<?
define('DB_NAME', 'mydatabasename');
define('DB_USER', 'mylogin');
define('DB_PASSWORD', 'mypassword');
define('DB_HOST', 'localhost');
?>

The thing is I’m no PHP or MySQL expert. The programmer let me without support, so I’m on my own.

When I try to load my site, it gives the following errors:

Warning: mysql_query() [function.mysql-query]: Access denied for user 'mylogin'@'localhost' (using password: NO) in /home/mylogin/public_html/index.php on line 42

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/mylogin/public_html/index.php on line 42

ERROR 40 >Access denied for user 'mylogin'@'localhost' (using password: NO)

On the file index.php, line 42 is this:

$sqlo = mysql_query("select *, max-buyers 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 that I need these two lines to work with the new hosting, but whenever I try to insert them, it gives new errors:

date_default_timezone_set('America/Sao_paulo');
mysql_query("SET time_zone='-3:00'");

Any ideas of how I can get this working?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T00:43:58+00:00Added an answer on May 23, 2026 at 12:43 am

    Try this:

    <?
    date_default_timezone_set('America/Sao_paulo');
    $conexao = mysql_connect("localhost","mylogin","mypassword");
    $bd = mysql_select_db("mydatabasename");
    mysql_query("SET time_zone='-3:00'");
    ?>
    

    What I’ve done is simplify the original code to remove the IF / ELSE statement which looks like it might be there for development purposes.

    If you’re getting other errors not posted, please include them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First off, let me start by saying that I am totally new to working
Let me start off by saying that this is my first time working with
First let me start off by saying I do not believe I am leaking,
Ok, let me first start off by saying that I've only ever dealt with
First let me start of saying I know absolutely nothing about c++ and I
first let me start by saying I'm pretty new to iPhone, so I apologise
First let me start by saying that I don't have a complete understanding of
First off let me start by saying I am using CodeIgniter and the Facebook
This is my first post, so let me start by saying HELLO! I am
Let me start off by saying that this is my first real Cocoa app.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.