Jump to content

Question

Posted

i dont know if this is the correct section if it isnt sorry,i posted here because i saw some php guides  in this section... anyways

i have a database in a dedicated server and i want to connect to the dedicated server's database from the web servers computer 

i know how to script a db connection(local) but i dont know how to connect the db of another computer can u please help me? 

9 answers to this question

Recommended Posts

  • 0
Posted

If you know to create a db scrip then, you have to be sure your computer with database have port 3306 allowed in firewall for outside connection then in your  db conection script you have to enter ip of computer user / pass...

  • 0
Posted (edited)

so i  tried to connect  and it was giving me instantly a error that cant connect to the mysql server then i opened the port  and it is trying to connect and after a minute error message tells that cant connect

Warning: mysql_connect(): Can't connect to MySQL server on '78.87.60.73' (4) in /home/l2gold/public_html/test.php on line 7
Failed to connect

this is the php code 

<?php
// Create connection
$con=mysqli_connect("78.87.60.73","root","","l2jesios");


if(!$con)
{
echo "Failed to connect";
}
else
{
echo "Connected";
}
?>

i disabled FireWall and now it gives this msg

Warning: mysql_connect(): Host 'ns5001871.ip-192-99-16.net' is not allowed to connect to this MySQL server in /home/l2/public_html/test.php on line 7
Failed to connect

i opened the port 3306 on 192.168.1.9

Edited by Nitzamc
  • 0
Posted

You need to give privilieges to your host, then it will be able to connect.

 

GRANT ALL PRIVILEGES ON *.* TO mysql@'ns5001871.ip-192-99-16.net';

 

Execute this query and then try connecting using your same host. 

 

  • 0
Posted (edited)

gived privileges and now it gives another message 


Warning: mysqli_connect(): (28000/1045): Access denied for user 'web@192.99.16.76'@'ns5001871.ip-192-99-16.net' (using password: YES) in /home/l2/public_html/test.php on line 7
Failed to connect to MySQL: Access denied for user 'web@192.99.16.76'@'ns5001871.ip-192-99-16.net' (using password: YES)


Edited by Nitzamc
  • 0
Posted

 

gived privileges and now it gives another message 


Warning: mysqli_connect(): (28000/1045): Access denied for user 'web@192.99.16.76'@'ns5001871.ip-192-99-16.net' (using password: YES) in /home/l2gold/public_html/test.php on line 7
Failed to connect to MySQL: Access denied for user 'web@192.99.16.76'@'ns5001871.ip-192-99-16.net' (using password: YES)


Thats mean you have added wrong password

  • 0
Posted

i WILL MAKE A TUTORIAL FOR THIS & no one will get error! i understand everything because i was trying to make a db connection from another server like 4 hours and finally i did!!!!!!

i had wrong username xD

  • 0
Posted

i WILL MAKE A TUTORIAL FOR THIS & no one will get error! i understand everything because i was trying to make a db connection from another server like 4 hours and finally i did!!!!!!

i had wrong username xD

I guess it can be locked then.
Guest
This topic is now closed to further replies.


  • Posts

    • WTB Myext64 by @eressea missing adition OfflineShopRestore then server restart. Offer: 20 USD Payment with Crypto, then all working and tested in my live server. My discord: Jen2#1273
    • Hey, gamers!   I'm thinking about launching a High Five x30 server and would love to hear your thoughts! Would you play on a server with these features? 🔹 No Pay-to-Win – no items that give an unfair advantage. 🔹 Donations only for premium, noblesse, and skins – purely cosmetic or convenience-based. 🔹 Daily rewards from farming – active players get rewarded. 🔹 Only 1 dual box allowed – to keep the gameplay fair.   What do you think? Would you play on such a server? Any feedback or suggestions are welcome! Join our Discord to discuss: https://discord.gg/zeArBXcAxh
    • L2JHellas Test Server is Live!  If you want to test L2JHellas , you can check discord for the .ini file to connect. The test server will be online 24/7, so feel free to hop in anytime!  Accounts are auto created!
    • I appreciate your kind words. Indeed, assuming the client is functioning properly, most common packs struggle with the way they handle tasks, often broadcasting packets inefficiently, which can cause issues. For sure, it will require deep searching and debugging to identify these mistakes, but it can definitely be done!
    • Accounts "Early Supporter Badge"   Clean And Empty Clean 4L Username Full Access, Safe Comes With OGE (OGE Tested, REG Mail, Billing Mails) Or Comes With Email Linked 2-6 Months Price: It Varies According To The Specifications Of Each Account Min: 399$ Max: 599$   Accounts "Server Booster Badge"   Clean And Empty Clean 4L Username Full access, Safe Comes With OGE (OGE Tested, REG Mail, Billing Mails) Or Email Change  Price:  It Varies According To The Specifications Of Each Account Min: 39$ Max: 99$   To Buy, Contact Me On: Discord @xdids Telegram @xdids   To See, Vouches, Stock, Payment Methods, Click Or Go Telegram Or Discord  Profile Bio   Stock Is Updated At Any Time. To See Currently Available Accounts, Head Over To Stock Telegram Channel "t.me/xdist"
  • Topics

×
×
  • Create New...