Forum Moderators: open

Message Too Old, No Replies

Mysql newbie question

access remote server mysql account

         

Animated

8:32 am on Apr 27, 2007 (gmt 0)

10+ Year Member



hi i am new to mysql, my question is can i download mysql on my own computer and then use it to access the remote server of of my website? the web hosting company has already given me the databasename,username,password and so on.

phranque

9:29 am on Apr 27, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



i've never tried it but you should be able to access a remote host using the -h option for the mysql client.
you will probably have to do some mysql privilege setup work on the server to allow yourself access from the remote host.
there are also several web-based clients available you might be able to use.

Discovery

1:09 pm on Apr 27, 2007 (gmt 0)

10+ Year Member



I am not getting you, what actually you want to do.
But,
You can have mysql in your local comp but to access from remote web serve you must have public IP address for your local machine.

To connect from a PHP script, just put this in your file:
<?php
$dbhost = ""; //Your database host or IP
$dbname = ""; //Your database name
$dbpass = ""; //Your database password
$dbuser = ""; //Your database username

mysql_connect ($dbhost, $dbuser, $dbpass) or die (mysql_error()); //Connects to database
mysql_select_db ($dbname) or die (mysql_error()); //Selects your database
$date = date("h:i A dS M");
$query = "INSERT INTO table (name, date, message, email) VALUES ('$name','$date','$message','$email');
mysql_query($query);
mysql_close();
echo "Thank you for entering the values!";
echo "Click <a href='view.php'>here</a> to view your message!";
?>

[edited by: Discovery at 1:11 pm (utc) on April 27, 2007]

Animated

6:15 am on Apr 30, 2007 (gmt 0)

10+ Year Member



thanx for the replies:)
i do access it through php thats no problem but i like to work directly through the mysql application window and i know i can set it up as 'local host' for my own computer but i want to access my mysql databse of the webhosting company without any third party programs or because its on my computer i can just use it as a 'local host' data base?

phranque

9:19 am on Apr 30, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



the answer is yes you can do what you want in theory, but in practice you will probably need help on the server end:
- the port to access mysql over tcp/ip (usually 3306) may not be open or may have been limited or changed to a nonstandard port number.
- mysql db is typically set up for localhost access and you will have to add privileges for remote users.