title: mysql_connect(): Access denied for user 'user'@'host' (using password: NO)
body: <p>I understand this question is asked a lot but since the fix is situational, I'm asking this question.</p>
  
  <p>Error: <strong>mysql_connect(): Access denied for user 'username'@'boscustweb0406.eigbox.net' (using password: NO)</strong> </p>
  
  <p>So I have a script that I want to install on my shared server.  The script can create a database on it's own but I'm not allowed to do that on this server, so I have to manually create it.</p>
  
  <p>It highlights this line on the error page:</p>
  
  <pre><code>67             $userName = $this-&gt;userName;
  68             $password = $this-&gt;password;
  69             $databaseName = $this-&gt;databaseName;
  70             
  71             /*$connection = new CDbConnection($localhost,$userName,$password);
  72             $connection-&gt;active=true;
  73             $sql = "SHOW DATABASES LIKE $databaseName";
  74             $command = $connection-&gt;createCommand($sql);
  75             $rowCount=$command-&gt;execute();  */
  76             
  77             //$command = $connection-&gt;createCommand($sql);
  78             
  79             $con = mysql_connect($localhost,$userName,$password);
  80             if (!$con)
  81             {
  82                 $this-&gt;addError('databaseName','Database already exist');
  83             }
  84             else 
  85             {
  86                     if(mysql_select_db($databaseName))
  87                     {
  88                         $this-&gt;addError('databaseName','Database already exist');
  89                         return false;
  90                     }
  91             }
  </code></pre>
  
  <p>I've checked and double-checked all details and they are correct.</p>
  
  <p>Here's my validation model:</p>
  
  <pre><code>50             $userPassword = base64_encode($_POST['InstallForm']['userPassword']);
  51             $name = $_POST['InstallForm']['name'];
  52             $compnyName = $_POST['InstallForm']['compnyName'];
  53             $language = $_POST['InstallForm']['language'];
  54             $timeZone = $_POST['InstallForm']['timeZone'];
  55             if($model-&gt;validate())
  56             {
  57                 $con = mysql_connect($hostName,$userName,$password);
  58                 $dat = "CREATE database $databaseName";
  59                 
  60                 $controlVal = '$controllername';
  </code></pre>
  
  <p>You can replicate the issue here: <a href="http://staging-sendy.elionweb.com/" rel="nofollow">http://staging-sendy.elionweb.com/</a></p>
  
  <p>Use the host <strong>elionweb.ipagemysql.com</strong>, then put anything else you want in the other fields and you'll get the same error.</p>
  
  <p>I successfully got the script installed on my local machine without any errors, so hopefully someone here can help me figure this out.</p>