I understand this question is asked a lot but since the fix is situational, I'm asking this question.
Error: mysql_connect(): Access denied for user 'username'@'boscustweb0406.eigbox.net' (using password: NO)
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.
It highlights this line on the error page:
67 $userName = $this->userName;
68 $password = $this->password;
69 $databaseName = $this->databaseName;
70
71 /*$connection = new CDbConnection($localhost,$userName,$password);
72 $connection->active=true;
73 $sql = "SHOW DATABASES LIKE $databaseName";
74 $command = $connection->createCommand($sql);
75 $rowCount=$command->execute(); */
76
77 //$command = $connection->createCommand($sql);
78
79 $con = mysql_connect($localhost,$userName,$password);
80 if (!$con)
81 {
82 $this->addError('databaseName','Database already exist');
83 }
84 else
85 {
86 if(mysql_select_db($databaseName))
87 {
88 $this->addError('databaseName','Database already exist');
89 return false;
90 }
91 }
I've checked and double-checked all details and they are correct.
Here's my validation model:
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->validate())
56 {
57 $con = mysql_connect($hostName,$userName,$password);
58 $dat = "CREATE database $databaseName";
59
60 $controlVal = '$controllername';
You can replicate the issue here: http://staging-sendy.elionweb.com/
Use the host elionweb.ipagemysql.com, then put anything else you want in the other fields and you'll get the same error.
I successfully got the script installed on my local machine without any errors, so hopefully someone here can help me figure this out.
The "using password: NO" line tells me that your $password variable is empty.
Then I looked into your code, and it seems that the attribute names on the form and your validation model is mismatched. On your form (using the link you provided), I see: name="InstallForm[password]", but in your validation model this code looks like: $userPassword = base64_encode($_POST['InstallForm']['userPassword']); Look a little closer and you'll see that "password" doesn't match "userPassword".
There are a few other mismatched attributes as well. Your form has: name="InstallForm[userName]". But your validation model has: $name = $_POST['InstallForm']['name'];
In addition, the attribute "compnyName" seems to be misspelled, but it seems that you misspelled it through out the code, so that one might not cause any problem.