| | |
MySQL server address NOT localhost
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
I've had a good trawl through search and Google, but can't get to grips with a problem. I don't know if it is possible, but here goes:
A friend asked me to install a few mods to his phpBB3 site. No problem. However, there were a few that required SQL tweaks. He has his site/DB on a private web server and doesn't know the host address for the DB. I can access the DB through a custom pHp script using localhost as host and his login credentials.
What I need to know:
Is there a MYSQL/PHP function that returns the server/host name or address? I want to remotely access the DB using SQLyog or Navicat. I'm not to happy using SQL strings in a form to get stuff done (a bit like whistling in the dark). pHpMyAdmin is not on the account and will not be installed.
Thanks in advance
A friend asked me to install a few mods to his phpBB3 site. No problem. However, there were a few that required SQL tweaks. He has his site/DB on a private web server and doesn't know the host address for the DB. I can access the DB through a custom pHp script using localhost as host and his login credentials.
What I need to know:
Is there a MYSQL/PHP function that returns the server/host name or address? I want to remotely access the DB using SQLyog or Navicat. I'm not to happy using SQL strings in a form to get stuff done (a bit like whistling in the dark). pHpMyAdmin is not on the account and will not be installed.
Thanks in advance
"...the woods would be a very silent place if no birds sang except for the best"
All opinions count - unless you're a serial downvoter.
F'enw i yw Mr. Blaidd. Byddwch yn ofalus - dwi'n cnoi.
All opinions count - unless you're a serial downvoter.
F'enw i yw Mr. Blaidd. Byddwch yn ofalus - dwi'n cnoi.
Well for the phpbb cms I will have a look for any hacks to do this but codewise it is the following line which needs to be configured weather you can do it though the config file or if a hack is needed:
So I will check out phpbb for you as it may be possible to do it through the config file.
---------------
Edit:
I just tried installing phpbb3 from a remote database and it appears what you need to do is first install phpbb3 on the server which supports mysql and at the same time specify the domain instead of localhost as the connection address. Then after installation, confirm in the config.php file that mysql is set to load from the remote server (currently the current server) and is not set to localhost. After that, you may transfer all the files to the other server that hasn't got databases and should read the remote server as it was specified during installation. The reason why the files need to be installed on the server with mysql is because of a validator that checks what types of databases are available.
php Syntax (Toggle Plain Text)
mysql_connect('localhost', 'mysql_user', 'mysql_password'); //above needs to be changed to mysql_connect('website.com', 'mysql_user', 'mysql_password');
---------------
Edit:
I just tried installing phpbb3 from a remote database and it appears what you need to do is first install phpbb3 on the server which supports mysql and at the same time specify the domain instead of localhost as the connection address. Then after installation, confirm in the config.php file that mysql is set to load from the remote server (currently the current server) and is not set to localhost. After that, you may transfer all the files to the other server that hasn't got databases and should read the remote server as it was specified during installation. The reason why the files need to be installed on the server with mysql is because of a validator that checks what types of databases are available.
Last edited by cwarn23; Feb 17th, 2009 at 4:09 am. Reason: added info
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Thanks cwarn - I really appreciate the time taken to look into my problem. My problem is that the board has already been set up (since 2002) and was updated to phpBB3 a good while ago. Unfortunately, the DB host name is not known but resides on the same server as the site (one of many sites, so using the site url is no good). I need to find the name of the host to connect remotely. At present I have this dirty (truncated) form (taken down when not in use), which actually works:
The form has 2 fields 'cod' (password for running the script) and 'sq' (SQL string to run). What I'm after is the hostname so I can use SQLyog/Navicat as a GUI from my machine. Is there an SQL or php function/command that will return the actual hostname?
Thanks again.
PHP Syntax (Toggle Plain Text)
if($_POST['cod'] == "xxxxxx"){ $mewnbwn = stripslashes($_POST['sq']); if(!strstr(strtolower($mewnbwn),'delete') && !strstr(strtolower($mewnbwn),'update')){ $dbhost = 'localhost'; $dbname = 'xxxx'; $dbuser = 'xxxx'; $dbpasswd = 'xxxx'; $link_id = mysql_connect($dbhost, $dbuser, $dbpasswd) or die('No link'); mysql_select_db($dbname, $link_id); $cofnodion = mysql_query($mewnbwn) or die('No query run'); echo "Query OK"; }else{ echo "No UPDATES/DELETES"; } }
Thanks again.
"...the woods would be a very silent place if no birds sang except for the best"
All opinions count - unless you're a serial downvoter.
F'enw i yw Mr. Blaidd. Byddwch yn ofalus - dwi'n cnoi.
All opinions count - unless you're a serial downvoter.
F'enw i yw Mr. Blaidd. Byddwch yn ofalus - dwi'n cnoi.
does the host have a helpscreen with the server names
ours is a cheap host and to avoid phone calls there is a page outside the control panel
that lists
mail.[yoursitenam].com
smtp.[yoursitenam].com
mysqlhost.[yoursitenam].com
ftp.[yoursitenam].com
ssh.[yoursitenam].com
controlpanel.[yoursitenam].com
etc
ours is a cheap host and to avoid phone calls there is a page outside the control panel
that lists
mail.[yoursitenam].com
smtp.[yoursitenam].com
mysqlhost.[yoursitenam].com
ftp.[yoursitenam].com
ssh.[yoursitenam].com
controlpanel.[yoursitenam].com
etc
Failure is not an option It's included free
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
•
•
Join Date: Jul 2008
Posts: 148
Reputation:
Solved Threads: 25
If the server is configured to allow access from the outside world, then just use the ip of the machine to connect to it.
At least in terms of cPanel you need to add external hosts to the permissions for connections outside of localhost.
I *believe* DirectAdmin was/is the same way.
At least in terms of cPanel you need to add external hosts to the permissions for connections outside of localhost.
I *believe* DirectAdmin was/is the same way.
Last edited by mschroeder; Feb 17th, 2009 at 3:03 pm.
If you're question/problem is solved don't forget to mark the thread as Solved!
-- Code I post is usually but not always tested. If it is tested it will be against 5.2.11 or 5.3.0
-- Code I post is usually but not always tested. If it is tested it will be against 5.2.11 or 5.3.0
AB: no urls with the hosting: its on a private server - the owner (of the webserver) isn't very clued up either. Bit of a cowboy job actually.
MS: The IP of the site doesn't allow ext. access when I tried it. There's no cPanel. I'm really at a loss.
Anyway, thanks for your input guys. If you can think of anything else, I'd really appreciate it, but I'm hoping the owner will come back to me soon with something concrete. I'm sorry I even offered to help my mate now!
MS: The IP of the site doesn't allow ext. access when I tried it. There's no cPanel. I'm really at a loss.
Anyway, thanks for your input guys. If you can think of anything else, I'd really appreciate it, but I'm hoping the owner will come back to me soon with something concrete. I'm sorry I even offered to help my mate now!
"...the woods would be a very silent place if no birds sang except for the best"
All opinions count - unless you're a serial downvoter.
F'enw i yw Mr. Blaidd. Byddwch yn ofalus - dwi'n cnoi.
All opinions count - unless you're a serial downvoter.
F'enw i yw Mr. Blaidd. Byddwch yn ofalus - dwi'n cnoi.
•
•
Join Date: Jul 2008
Posts: 148
Reputation:
Solved Threads: 25
Well, if you can execute commands against the server, you could try this:
The options are pretty straight forward but just in case:
{database} = db name
{username} = login
{ip address} = YOUR ip address (http;//www.whatismyip.com) (Can use a % to indicate a wildcard aka 192.168.1.%)
{password} = the password
If that doesn't work it can also be achieved by using an INSERT if the user you are connecting to the server with has the appropriate permissions. Its all in the mysql docs with examples and such. Its a long shot but it might get you somewhere.
sql Syntax (Toggle Plain Text)
GRANT ALL PRIVILEGES ON {database}.* TO '{username}'@'{ip address}' IDENTIFIED BY '{password}' WITH GRANT OPTION;
The options are pretty straight forward but just in case:
{database} = db name
{username} = login
{ip address} = YOUR ip address (http;//www.whatismyip.com) (Can use a % to indicate a wildcard aka 192.168.1.%)
{password} = the password
If that doesn't work it can also be achieved by using an INSERT if the user you are connecting to the server with has the appropriate permissions. Its all in the mysql docs with examples and such. Its a long shot but it might get you somewhere.
If you're question/problem is solved don't forget to mark the thread as Solved!
-- Code I post is usually but not always tested. If it is tested it will be against 5.2.11 or 5.3.0
-- Code I post is usually but not always tested. If it is tested it will be against 5.2.11 or 5.3.0
![]() |
Similar Threads
- updating records using php and mysql (PHP)
- Error 2003: Can't connect to MySQL server on 'localhost' (99) (MySQL)
- Apache (Linux Servers and Apache)
- MySql Remote Connection - Hacking? (MySQL)
- Cookies problem - not working (PHP)
- MySql/Software Installation-Beginner (MySQL)
- pagination of mysql query results (PHP)
- updating records using asp and mysql (ASP)
- MySQL. Very much a beginner (MySQL)
- php wont submit data into the database (PHP)
Other Threads in the PHP Forum
- Previous Thread: Click on add to continue playing
- Next Thread: PHP friend Display
| Thread Tools | Search this Thread |
ajax apache api array basics beginner binary bounce broken cakephp checkbox class cms code codingproblem combobox cron curl database date display dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla js limit link login loop mail menu mlm mobile multiple mysql nodes oop outofmemmory paging parse paypal pdf php problem procedure query radio ram random recursion regex remote return script search server sessions smash sms soap source space sql syntax system table tutorial up-to-date update upload url validation validator variable video web webapplications websitecontactform xml youtube






