Forum Moderators: coopster
I have an online site and I want to set this up as a copy so that I can develop offline.
ONLINE - I went to phpmyadmin and did export database. I copied the sql output and input it to my OFFLINE phpmyadmin.
The database was created and I can browse the database fine.
In each ONLINE .php file there is an include link to dbinfo.php which includes the logins, passwords and mysql_connect commands.
I have changed the login and password information in the OFFLINE config.inc.php.
I get the error message "Unable to select database"
When I try and change any of the info in the dbinfo.php, it says
"Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'myusername'@'localhost' (using password: YES) in C:\Program Files\xampp\htdocs\ref\dbinfo.php on line 7
Unable to select database
This makes me believe that I have the username and password right, but for some other reason I can't connect to the database.
Is that true?
Do the username&password details get moved across with the db?
I'm a real beginner here, and I've checked that all relevant settings between ONLINE and OFFLINE match in config.inc.php, (I think) but I don't know what else to try.
All help appreciated.
but a GREAT one is WAMP5
it has everything you need and install comes easy
Back to your actual problem: Try to go in PHPmyAdmin, at the very opening page
Select “Privileges”
Add a new user
Create the new user and do not restrain any access (OK all)
Then try to conn to your DB by using the new ID
<Edit>
BTW was it an auto install or did you install each elements?
</Edit>
OK, I've created a new user called test@%. (I presume the "% means any host and not just localhost.)
I've set it up with ALL privileges, (I presume I don't need to set it up on the database level, just the user level.)
I'm using a simple file of:
<?
$username="test";
$password="test";
$database="mydatabase_db";
error_reporting(E_ALL);
mysql_connect('localhost',$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
?>
And it still gives the error of "Unable to select database"
So now I've created a new database via phpmyadmin.
When I try to connect to that with the new fully privileged user I still get the same error.
Where else do I need to set the username and password for accessing the database?
try connecting by using localhost, root as a UN and for PW use " " (empty, no password required)
<<<
I've set it up with ALL privileges, (I presume I don't need to set it up on the database level, just the user level.)
>>>>>
How did you set the privileges if not at DB level?