PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Tue Jul 23, 2019 1:43 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Using PHP with MySql
PostPosted: Tue May 15, 2012 10:29 pm 
Offline
Forum Newbie

Joined: Mon May 14, 2012 5:16 pm
Posts: 6
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 ?


Top
 Profile  
 
 Post subject: Re: Using PHP with MySql
PostPosted: Tue May 15, 2012 11:19 pm 
Offline
Site Administrator
User avatar

Joined: Wed Aug 25, 2004 7:54 pm
Posts: 13592
Location: New York, NY, US
You need to create users in MySQL. These users have a username and password. You can also give the users access privileges. Or better is to create users with no privileges and then define the privileges that the user can have for each database they are allowed to access.

_________________
(#10850)


Top
 Profile  
 
 Post subject: Re: Using PHP with MySql
PostPosted: Tue May 15, 2012 11:35 pm 
Offline
Forum Contributor
User avatar

Joined: Sat Oct 01, 2011 9:29 pm
Posts: 156
Location: Colorado, USA
wamp (xampp or lampp -> used to be called xampp -> used to be called wampp) is usually packaged with:

Apache
PHP
MySQL
FTP (I forgot which program)
SMTP (again, forgot)
Java Server? (no clue what, how, or why)

The default MySQL user/password for a standard xampp/lampp installation is root and null (as in nothing)
You do need these in order to connect to MySQL. If you don't have them, you can't connect.

MySQL returns errors to PHP through mysql_error();
run echo(mysql_error()); to see if you have any.

Also, if you really are using a version called "wampp" - your are using a very, very old version (2000-ish?) - get xampp (for windows) or lampp (for linux). I suppose you could also get xampp for mac or solaris. - install and enjoy. There should be no errors.
http://www.apachefriends.org/en/xampp.html <- xampp


Top
 Profile  
 
 Post subject: Re: Using PHP with MySql
PostPosted: Tue May 29, 2012 8:10 am 
Offline
Forum Newbie

Joined: Sat May 26, 2012 8:45 pm
Posts: 10
You can set your MySQL root password using .


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group