September 5, 201115 yr Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'membersh_db'@'localhost' (using password: YES) in /home/membersh/public_html/index.php on line 9 MySQL Error: Access denied for user 'membersh_db'@'localhost' (using password: YES) i get this when comnnecting, however the db user name and pass are all correct... wth :S] $dbhost = "mysql.x10hosting.com"; // info to connect to database $dbname = "membersh_db"; $dbuser = "membersh_user"; $dbpass = "password1"; line 9 mysql_connect($dbhost, $dbname, $dbuser, $dbpass) or die("MySQL Error: " . mysql_error()); // connects to database Edited September 5, 201115 yr by kingy da killa
September 5, 201115 yr Are you sure your mysql server allows remote connections? You may need to do something like add your webservers IP address to the list of allowed connections.
September 5, 201115 yr mysql_connect($dbhost, $dbuser, $dbpass) or die("MySQL Error: " . mysql_error()); // connects to database mysql_select_db($dbname) or die ("Unable to Select Database - Check Databse name"); Edited September 5, 201115 yr by Samus
September 5, 201115 yr Author Are you sure your mysql server allows remote connections? You may need to do something like add your webservers IP address to the list of allowed connections. its a free host so i guess it dont alow remote connections.. bummer
September 5, 201115 yr There could be an option to ssh tunnel. However not likely on a free host. Best of luck!
September 5, 201115 yr its a free host so i guess it dont alow remote connections.. bummer mysql_connect($dbhost, $dbuser, $dbpass) or die("MySQL Error: " . mysql_error()); // connects to database mysql_select_db($dbname) or die ("Unable to Select Database - Check Databse name"); Try that bro^ The syntax for mysql_connect() is (host, username, password) in this case you did (host, databasename, username) which is wrong. So the server is reading the connection as you giving your username as a databse and you giving your password as a username. See it just wouldn't work. Edited September 5, 201115 yr by Samus
September 5, 201115 yr Try that bro^ The syntax for mysql_connect() is (host, username, password) in this case you did (host, databasename, username) which is wrong. So the server is reading the connection as you giving your username as a databse and you giving your password as a username. See it just wouldn't work. Totally failed to see that!
September 5, 201115 yr personally i'd be using the new mysqli lib or pdo mysqli_connect(host,user,pass,database);
Create an account or sign in to comment