Jump to content

[SOLVED] WAMP Database selection


Kurrel

Recommended Posts

Hi everyone,

 

I'm using WAMP5 (1.6.6) for the first time, trying to do some small-time home development.  This comes with Apache, MySQL and PHP5 all bundled together.

 

I already develop for a PHP company, but everything's already set up in that arena and my problem is the 'getting everything going' phase.

 

I've set up a database called 'testdb' with the SQLiteManager that comes bundled with the WAMP and written a query to fetch the data from a table 'testtable'.  my query is '$query = "SELECT * FROM testtable WHERE 1=1";' and '$result = mysql_query($query) or die(mysql_error());'.

 

On execution, I get 'Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\FirstRun\index.php on line 9

 

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\wamp\www\FirstRun\index.php on line 9

Access denied for user 'ODBC'@'localhost' (using password: NO)'

 

I suspect it's a database selection problem and am going through notes to try remedy this myself... but if someone can answer in the time it takes me to fix it, I'd appreciate it!

 

~K

Link to comment
https://forums.phpfreaks.com/topic/58371-solved-wamp-database-selection/
Share on other sites

post your code. First u need to set a password for root account from command prompt

 

:\>mysql -u root

mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');

mysql> SET PASSWORD FOR 'root'@'%' = PASSWORD('newpwd');

 

if u don't want to encrypt ur password, remove PASSWORD() function

SET PASSWORD FOR 'root'@'localhost' = 'newpasswd';

 

and then code should be something like this

$link=mysql_connect('localhost', 'root', 'password') die(mysql_error());
$query = "SELECT * FROM testtable WHERE 1=1";
$result=mysql_db_query('testdb', $query, $link ) or die(mysql_error());

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.