Jump to content


[MySQL] How do I connect to MySQL from PHP?

  • This topic is locked This topic is locked
No replies to this topic

#1 Cryo Kinesis

Cryo Kinesis

    Haphost Staff

  • Moderators
  • 128 posts
  • LocationGridania, Eorzea

Posted 05 August 2014 - 04:28 PM

Hi there,


The first thing you will need to do when using PHP and mySQL is to connect to the mySQL database from PHP.

Luckily there are a couple of functions in PHP that make it easy. Once you get it working you can just copy and paste at the top of each script that requires the database or use a template or include file of some sort to include the details.

And that’s all there is to it – use your username, host, password and database name and this will establish the connection.

The most common problem is that you get the password wrong so double check it’s right if you get errors.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users