You can laugh at this question if you like...
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
connect to MySQL your database from PHP
@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.
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:
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
Learning Linux there is a big learning curve,but when you master it and understand it,it will be worth it.
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.