PDA

View Full Version : Cannot connect to mysql


J7HNW
02-07-2010, 01:42 AM
Hi

Have just bought ECart 5 so need to learn how to work this in PHP. I always used ASP but figured I need to switch as you have dropped ASP. So I need to set up my first SQL database.

I have installed XAMP as per instructions on your site . If I hit the URL localhost - all is running properly , PHP info looks good etc etc

So my local testing server is set up. I set it to run as a service when Windows 7 starts

However when I go into Dreamweaver and open a PHP file - and then try to add a MySQL connection - I get stuck

I get a screen - and I am setting as follows. I am trying this with "root" and no password as I cannot get in wth anything and I gather this is the default User

Connection name : hair
MySql: localhost
User Name: root
Password:
Database

When I browse for the database - I am gettng MySQL Error#:1045
Access denied for user 'root'@localhost ( using password: NO )

Please can you help . I need to get the site done quickly and just need to get started

Thanks

John

Office Guy-172461
02-07-2010, 09:24 AM
Have a look at:

Logging into a MySQL database
http://www.ipvac.com/kb/entry/149/

Creating a dynamic site definition in Dreamweaver
http://www.ipvac.com/kb/entry/151/

J7HNW
02-08-2010, 08:33 AM
Hi and thanks for your reply.

I am using XAMP. When I try to log in as "root " which is clearly stated as a super user in your "logging into a database " article - I am not allowed in. It says Root does not reequire a password - so I am entering root as user and leaving the password field blank

The site is set up correctly as per your other aricle - except my XAMP is in the folder
c:\xammp\xammp\htdocs . It is not a powerstore site so I have not applied this path.

Indeed I have set up a site called Hair for men as follows

c:\xammp\xammp\htdocs\Hair for men\httpdocs\

This is where my php files are stored. Under httpdocs - I have added a folder called data - and the SQL database is in the data directory

c:\xammp\xammp\htdocs\Hair for men\httpdocs\data\


I should in theory be able to log in and browse to this file - shouldnt I ?

Office Guy-172461
02-08-2010, 08:49 AM
I think you missed this note:

Note: The name should not include any spaces or special characters. You should never use spaces or special characters in folder or file names for a website, because they cause problems on most PHP servers.

You can't just put a database into a folder. It must be imported into your mySQL server:

Exporting and Importing a database using phpMyAdmin
http://ipvac.com/kb/entry/150/

J7HNW
02-08-2010, 10:08 AM
Hi and thank you for your speedy response.

I have renamed the site Hairformen so all folders now have no spaces ( sorry I did miss this )

Local Info now reads

Root folder is now : C:\xampp\xampp\htdocs\Hairformen\httpdocs\
Root images folder : C:\xampp\xampp\htdocs\Hairformen\httpdocs\images\

Testing Server PHP MySQL
Access: Local / Network
Testing server folder: C:\xampp\xampp\htdocs\Hairformen\
URL Prefix: http://localhost/Hairformen/

I have gond to the URL localhost which opens up PHP Admin

Here I am being asked for a User name and Password to log in

I have typed in root and left the password blank - and yet again I still cannot get into the Admin Panel to set up my database.

I am sorry for the confusion - I have done many ASP sites but cannot get my head around this. Hope you can help. Once I have managed to get the database into the site I am hoping there will be similarities on the PHP pages to the ASP I have always worked with.

Thank you

John

Office Guy-172461
02-08-2010, 11:21 AM
When you setup XAMPP you should have been asked to supply a password for mySQL. That is the password it's asking for.