Jump to content

[SOLVED] Php / MySql Help Plz


jcof88

Recommended Posts

Hello, I am new at PHP and Mysql and i need some help please....I am making a Lineage 2 Server and i want to add this php script to my site but i cant get it to work,

 

I have Installed MySql on my home pc

 

Installed MySql Like:

 

Opened port 3306 for mysql

 

Username : Root

 

Password: ( Mypass)

 

And  i also installed Navicat:

 

made my DataBase, Its called  l2jdb

 

username: root

 

password: (My Pass)

 

and it makes the connection between MySql and Navicat so every thing is working fine..

 

and i am hosting my website on ipower.com, it supports PHP...and i downloaded this php script to go with my server, and i am trying to make it connect to my mysql on my home pc but haveing problems its an account creator that way ppl can register to play the server so i need it to connect to the DataBase...

 

#-------------------------------------

# SQL Database Configuration

#-------------------------------------

$sql['host'] = "67.76.000.000";  //Sql server address  ( Masked ip with 0 )

$sql['user'] = "root";  //Sql login username

$sql['password'] = "85785";  //Sql login password

$sql['database'] = "l2jdb"; //Sql database name

 

 

 

And i am getting this message: MySQL: No connection, possible configuration Error!

 

please some one can help me....I cant get it to connect to my Mysql on my Home PC...

 

I am also using a router not sure if that matters...I opend port 3306

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/153674-solved-php-mysql-help-plz/
Share on other sites

Hmm, I always had my problems with port forwarding.

 

In the end it was always because I had set up my static IP wrong. Have you set up a static IP? If so does it match the one that you are using in your port forward settings.

 

oroN

 

Yes i have a static Ip, Also i am not sure on how i would do that because i am hosting my MySql on my PC and my lan ip is 192.168.1.103 my Static Ip is 67.76.***.***  ( Masked the rest ), I have a Linksys router, and under the Application & Gaming Tab I select Port Range Forwarding and i fill in the blanks like so:

 

Port Range:

 

Application:    Start  to  End:          Protocol:        IP Address:          Enable:

MySql            3306      3306            TCP & UDP      192.168.1.103        And I Check this..

 

so i am not sure what to do, can some one guide me threw this plz i would rlly appericate it...

 

 

Ok let me start from scratch hopefully i can word this better lol...

 

Step 1: Formated My PC - Installed Windows Xp

 

Step 2: Installed Java, and all the other stuff to run my programs

 

Step 3: Installed MySql 5.1

 

Installed Like:

 

a. Click "Complete Install"

b. Click " Configure the mysql server now"

c. Click "Standard Configuration"

d. Check " Install as a window service"  Service Name: "MySQL" Checked "Launch server automatically"  DIDNT Check "Include Bin Directory in windows PATH"

e. New Root Password:  ( MY PASS )

Check " Enable Root Access from remote Machines"

f. FINSH with mysql 

 

Then i Install Navicat:

a. Click " Connection" at top left side

b. Click the " General " Tab

 

Connection name: My Server

Host Name/IP: 192.168.1.103

Port: 3306

User name: Root

Pass: ( MY PASS )

 

Click Connect and it makes a connection...

 

Right click on my new Connection, Click " New Database "

Enter Database Name: l2jdb

Character Set: Default Character Set

Collation: ( Blank )

 

My Database is now working....

 

I go to my Router, Go to Application & Gaming, Port Range Forwarding,

 

Application:    Start  to  End:          Protocol:        IP Address:          Enable:

MySql            3306      3306            TCP & UDP      192.168.1.103        And I Check this..

 

 

Then i add this PHP script to my webhost and try to make a connection to mysql on my pc...

 

#-------------------------------------

# SQL Database Configuration

#-------------------------------------

$sql['host'] = "67.76.000.000";  //Sql server address  ( Masked ip with 0 )

$sql['user'] = "root";  //Sql login username

$sql['password'] = "85785";  //Sql login password

$sql['database'] = "l2jdb"; //Sql database name

 

And It dont work, Gets this message

 

MySQL: No connection, possible configuration Error!

 

 

PS: I do have a static Ip, and Have Linksys Router hope all this helps....Thanks Again

 

12651838.jpg

61130394.jpg

16828351.jpg

well i'm not even going to comment on *why* allowing access from the internet to your local database is a bad idea, but to each his/her own. your router settings look good. if you have access to an external system, one way to validate them is to telnet to port 3306. something like:

 

telnet <your static IP> 3306

 

if you don't get a connect error, then your router is likely setup fine. within mysql, though, have you granted the user root the ability to connect from your webhost? if you did this, you'd know. if you haven't, you need to. by default, mysql only allows root to connect from localhost. for more information on this, checkout the mysql documentation:

 

http://dev.mysql.com/doc/refman/5.1/en/default-privileges.html

 

jason

well i'm not even going to comment on *why* allowing access from the internet to your local database is a bad idea, but to each his/her own. your router settings look good. if you have access to an external system, one way to validate them is to telnet to port 3306. something like:

 

telnet <your static IP> 3306

 

if you don't get a connect error, then your router is likely setup fine. within mysql, though, have you granted the user root the ability to connect from your webhost? if you did this, you'd know. if you haven't, you need to. by default, mysql only allows root to connect from localhost. for more information on this, checkout the mysql documentation:

 

http://dev.mysql.com/doc/refman/5.1/en/default-privileges.html

 

jason

 

That makes sense, by default, mysql only allows root to connect from localhost ...probably why i cant make a connection from my webhost...

 

So what do i do, Can i give the default root the privilege to be connected from my webhost, or do i have to make a new user and pass and give all privileges...Sorry i am new at this and this is hard for me lol..

 

I am using navicat can i do anything in it ???

looks like you're at least making an initial connection. that "5.1.33-community" is the mysql version information. perhaps the easiest way to open up mysql would be to set the host column for the root user to '%'. an update statement like:

 

update user set host='%' where user='root' and host='localhost';

 

alternatively, you could set host to the IP or hostname of your webhost, but it doesn't appear you're concerned too much about security at this point so just open it up for now. at some point in the future you should tighten security to your mysql installation.

 

jason

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.