Jump to content

Archived

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

asongisabeautifullie

Connecting to MySQL

Recommended Posts

Hey

 

I\'ve pretty much just started using MySQL, and having installed it for my local server (Windows 2000 with IIS) and set the password for the root user I still find I can connect to my MySQL server without giving either a username or a password. This means I can run SQL statements in my PHP pages without specifying a connection to MySQL.

 

What do I do to ensure a password is needed to connect to the MySQL server?

 

Thanks, much appreciated

 

Adam

Share this post


Link to post
Share on other sites

U have to read more about

 

\"Environment Variable\" i.e u have to edit my.cfg file

 

U can prompt the user to enter the user name and password.

 

If u have a mysql manual u can learn more there

Share this post


Link to post
Share on other sites

Read this:

http://robouk.mchost.com/tuts/tutorial.php...utorial=server1

 

Browse to the setup area dealing with mysql tells you how to set a password for \"root\" the default user for mysql, also you can simply \"find and delete\" my.ini on your system and then re-run mysqladmin if your user newer 3.51+ versions of mysql it should prompt u for a username and password... Then in phpmyadmin go into the mysql databse find the users table and delete all entries \"ACCEPT\" for the user/password you currently want to use so is only one valid user/pass in the database.

Share this post


Link to post
Share on other sites

Thanks a lot, that was really helpful :D

 

I have another question though about performance. I\'m using PHP and MySQL to search a catalog of around 2000 books by author, title and publisher. Firstly, is searching 3 attributes (all varchar) with this many rows going to be really slow?

 

Secondly, the way I\'ve written my script at the moment the query is run every time a new page of results is displayed, so if there are 3 pages of results the query will be run 3 times even though the result set is the same, just starting further down the rows. Is there any way to get around this, or is this generally how all multiple results pages work?

 

Thanks again

Share this post


Link to post
Share on other sites

×

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.