You can laugh at this question if you like...

Rookie question.

I want to be able to connect to my MySQL via php, so that my website can access the database. For this to happen, do I need to have remote access turned on?

Also, in your php connection…

$host = "localhost";

$user= "MRblahblah";

$pass = "blahblah";

$dbname = "blahDB";

is the host 'localhost' for a Linode? Or is it something to do with the user I created for my Linode (the user that replaces root after I stop root access), or something to do with the host name and FQDN (say my hostname is 'MrQuestion' and the FQDN is 'theBridge').

Thanks guys - I'm almost set up, but misunderstanding some of the fundamentals here, and can't find in the guide where to answer these questions.

7 Replies

If your website is running on the same server as mysql, then no, you don't need remote access turned on. Leave $host as localhost so it'll know to connect to mysql on this server and not somewhere else.

@billygoatkaraoke:

Also, in your php connection…

$host = "localhost";

$user= "MRblahblah";

$pass = "blahblah";

$dbname = "blahDB";

is the host 'localhost' for a Linode? Or is it something to do with the user I created for my Linode

The username, password are your MySQL user account parameters, it's not the same thing as your linux username.

Not a stupid question, yes you access it through localhost and don't need to turn on remote access to the mysql server daemon.

Run this command: mysqlsecureinstallation

Google what all the questions are if you get confused, but this will help secure your installation. Set a really good password for the root. Don't use your mysql root account for php, create another account with only access to the databases it needs for php interaction.

reference for adding mysql users: http://dev.mysql.com/doc/refman/5.1/en/ … users.html">http://dev.mysql.com/doc/refman/5.1/en/adding-users.html

Hey guys

Thanks for all your help.

It's been a great learning experience, but I've opted to go with a managed host - too many variables for me to bugger up doing it myself.

I appreciated your time.

Shaun

Don't give it!

Learning Linux there is a big learning curve,but when you master it and understand it,it will be worth it.

hahaha - I understand where your coming from. I have to put that learning curve time into working on my site though (which comes with it's own learning curve). The priority is the site for now.

But learning what I have in the last few days setting up the Linode as much as I did has made it wayyyy easier to understand what's going on under the hood. Plus, I didn't know what SSH was before this, so learning some of that was worth it alone - now I understand a bit more about how DB admins connect etc.

Thanks mate - your help was fantastic.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct