PHP mysql connection string?
Posted by: elvendil (---.ukonline.co.uk)
Date: December 22, 2007 09:15PM

Hi All,

OK - set up and running (at last). But what are the settings for MySQL? I need to establish a database connection through mysqli - but I've no idea what the settings are that WAMP establishes?

$db_guest = new mysqli("URL", 'DATABASE', 'USERNAME', 'PASSWORD')
or
die ('I cannot connect to the database because: ' . mysqli_connect_error());

Options: ReplyQuote
Re: PHP mysql connection string?
Posted by: toivo (---.nsw.bigpond.net.au)
Date: December 22, 2007 09:31PM

Hi,

What your example shows as "URL" is usually "localhost".

"DATABASE" is the name of the database schema you want to connect to.

"USERNAME" is the name of the user you have set up and added a host from which you want to connect, with access rights to the schema.

"PASSWORD" is the password you have assigned to the user.

You can create databases and set up users by using either PHPMyAdmin or MySQL Administrator, or even the command line my running:

mysql -u root -p

There are instructions on this forum about all the above, just do a search on 'mysql username', for example.

Regards,

toivo
Sydney, Australia

Options: ReplyQuote
Re: PHP mysql connection string?
Posted by: elvendil (---.ukonline.co.uk)
Date: December 22, 2007 09:45PM

Thanks Tovio, but not quite what I was looking for. I know what the function parameters do - I just don't know what WAMP Server sets as defaults for these values.

Every time I've tried a search here I get a page telling me to be patient - that does absolutely nothing.

Options: ReplyQuote
Re: PHP mysql connection string?
Posted by: toivo (---.nsw.bigpond.net.au)
Date: December 22, 2007 10:58PM

Hi,

Click 'Return to search screen' and you will have the results there :-)

Regards,

toivo
Sydney, Australia

Options: ReplyQuote
Re: PHP mysql connection string?
Posted by: yfastud (Moderator)
Date: December 23, 2007 12:46AM

It's not just for this wamp, but original mysql come w/ default user "root" and no password, url is localhost and you have to create a new db in order to start using it

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote


Sorry, only registered users may post in this forum.