• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using PHP with MySql

 
nirjari patel
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have installed wamp server(apache, mysql, php for windows). It installs phpMyAdmin. When I try to open phpMyAdmin, it gives an error
"Error

MySQL said: Documentation
#1045 - Access denied for user 'root'@'localhost' (using password: NO)
phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server."
I was never asked to setup username or password, then why am I getting such an error ?

Secondly, when I have to use a database with php, it asks for database user and database password. What is this user and password ? When I create a database, I dont provide a username or password for this database. So how can I get this ?

I already had MySql installed on my computer. So how does this affect new installation of MySql with wamp ? How do I know which MySql am I using ? New one or already existing one ?

Thanks
 
Robin Nixon
Author
Ranch Hand
Posts: 48
Android Eclipse IDE PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried Zend Server CE?

It's free and by the people who wrote PHP. I recommend it above all other Wamps, particularly since I hear of far fewer problems (such as this one) from people installing it.

http://www.zend.com/en/products/server-ce/
 
Nick Charles
Ranch Hand
Posts: 71
Linux PHP Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nirjari patel wrote:I was never asked to setup username or password, then why am I getting such an error ?

The wamp installer probably ste a default password. You should look at the docs for your wamp server to find out what it set. (I always install the pieces separately, and the MySQL installer always asks for the root password to set.)

Secondly, when I have to use a database with php, it asks for database user and database password.

You alsways need to provide this information so that the database knows you have access. By the way, when MySQL gets installed, what you really get is a database server (yes, there are 2 databases created for that server, but you shouldn't use those). Before you use the database, you have to create one. The steps are usually:
1) Create the database
2) Create a user and assign rights to that database
This page should help, scroll down to the "Create a database using MySQL Commands" section:
http://drupal.org/documentation/install/create-database

I already had MySql installed on my computer. So how does this affect new installation of MySql with wamp ?

That all depends on how the wamp installer works. It could have used the existing MySQL, or it could have installed another one and set it to use a different port. In the latter case you will have both MySQLs running. Check Task Manager, and also look at the list of services in control panel.

By the way, it would help if you gave us the link to the wamp server that you downloaded and installed. There are several, and not knowing which one you used makes it difficult to help you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic