Setting up a mySQL database on a local host

  • pompei
  • Graduate
  • Graduate
  • pompei
  • Posts: 117

Post 3+ Months Ago

Hi,

I've got Apache running on my local machine (Windows XP Professional), which is great for trying out all those php scripts, but now I'm ready to get into more mySQL heavy code, but I don't actually know how to setup a mySQL server that I can access on my localhost.

Does anyone know how to set this up!? Thanks in advance to anyone that can help!
  • rjmthezonenet
  • Expert
  • Expert
  • User avatar
  • Posts: 526
  • Loc: St. John's, Newfoundland, Canada

Post 3+ Months Ago

Setting up MySQL on Windows is fairly straight forward.

Download the current stable release of MySQL

<ol>
<li>Install the distribution.
<li>Set up an option file if necessary.
<li>Select the server you want to use.
<li>Start the server.
<li>Assign passwords to the initial MySQL accounts.
</ol>

The complete installation instructions are in section 2.2.1 Installing MySQL on Windows of the manual

Post again if you have any troubles with the manual.
  • pompei
  • Graduate
  • Graduate
  • pompei
  • Posts: 117

Post 3+ Months Ago

Thanks a lot! I'll look into those.

In the meantime, I've been trying to connect to mysql with the following command:

mysql_connect (localhost, "myUserName", "myPassword");

which works fine, but is it possible to access the mySQL database from a php script running on a different server than the one mySQL is on? For instance:

mysql_connect("www.mydomainname.com", "myUserName", "myPassowrd");

The above code doesn't seem to work, at least, the access is denied. Is this a host-specific thing, or do I need to setup my mySQL in a specific way to allow this?

Thanks again
  • Axe
  • Genius
  • Genius
  • User avatar
  • Posts: 5739
  • Loc: Sub-level 28

Post 3+ Months Ago

Yeah you need to add the hostname of the remote server to the access list..

Just setup phpMyAdmin locally (with the MySQL root account), and have a look in the "mysql" database. You can see there how users are in the access list for databases.
  • rjmthezonenet
  • Expert
  • Expert
  • User avatar
  • Posts: 526
  • Loc: St. John's, Newfoundland, Canada

Post 3+ Months Ago

See the documentation for mysql_connect.

mysql_connect ( [string server [, string username [, string password [, bool new_link [, int client_flags]]]]])
  • pompei
  • Graduate
  • Graduate
  • pompei
  • Posts: 117

Post 3+ Months Ago

Thanks guys,

I checked with my server host, and they require that I inform them which hosts are allowed access to the database. Hopefully, when the time comes, they'll actually go and set it up for me...

At least its not something I can do something about (for the mo), but the advice/info is definately going to help me down the line ;)

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: Liamw411 and 134 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.