Jump to content

how to allow user remote access to mysql server


Recommended Posts

Having issues with trying to get my php commands to allow web browsers to access mysql server to retrieve and insert information.

Basically I wrote some php code to access a hidden file, that in turns holds mysql connection params. These params are the host name, user, password and the db that the browser needs to connect to.


The code is to first allow web browsers to establish a connection to my mysql DB on my box.

once the browser establishes a connection it is supposed to verify a user and pass and then continue to process the rest of my code. basically this is a simple hit counter I created from a tutorial that is supposed to show the collected data on the web page. the code works fine when I use it on my laptop (XP using easyphp to enable and communicate with my apache and mysql). For both systems the users are the same and aswell as the passwords.


Now in reality on my linux box when I run the browser I get an error telling that

Fatal error: Call to undefined function: mysql_connect() in /var/www/html/main.php on line 74


Basically it cannot perform this function:

$link = mysql_connect('localhost:3306', $db_user, $db_password);


There already is another php file that holds the values for $db_user, $db_password

in a hidden folder in my www root.


The localhost part was swapped back and forth between the value of $db_host , localhost, & the full dns name for my box. I also tried using the port # too, to direct the connection to the mysql specific port and

still unavailable to connect.


Now since it does work with my laptop I know that the code is not the issue.


I made sure that my router has the tunneling setting enabled.

Used mysqladmin to even try to connect and it failed: telling me that my connection with modem(ISP IP) is not allowed.

I then tried with mysqladmin to connect with my internal network ip for the sql server and it too tells me that I am not allowed to connect.


how do i go about to allow a user to have remote access to mysql server?

I tried various commands online and they do not work entirely and I cannot find a log specific to mysql in my box. I need to verify if the issue is connectivity to my box or to my mysql server.



Link to comment
Share on other sites

network connectivity to mysql is disabled by default


change the param in my.cnf


# Don't listen on a TCP/IP port at all. This can be a security enhancement,

# if all processes that need to connect to mysqld run on the same host.

# All interaction with mysqld must be made via Unix sockets or named pipes.

# Note that using this option without enabling named pipes on Windows

# (via the "enable-named-pipe" option) will render mysqld useless!



Edited by ddmcse
Link to comment
Share on other sites

yeah i was reading that on a site but the thing is that I had to recreate my own my.cnf file.

I doing so I took it from my-medium.cnf and renamed it.


that got my web min to access the file for managing.

however in that file there is no reference to skip-networking


so i am at a lost on what to do from here on out.

I tried messing around with variable but trying to create usr' with "php@"%" variables to try and set it and it still won't work.


I tried to look in my logs but I cannot find any logs that shows any mentioning to ysql let along any connection attempts to the box. If I could do that atleast I guess I would be able to at least see if the connection is trying to be established... is that correct?

Link to comment
Share on other sites

cut out the middle-man and use a mysql connector type thing to plain old access the db over the net verifing that works and worry about the php later

mysql has one or two that you can pop right in withan rpm

and i know there are many others to use , the names aren't coming to me right now

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...