Results 1 to 6 of 6
- 09-06-2004, 08:25 AM #1TDM_FDM Guest
How do I connect to MySQL remotely?
You can connect to your MySQL database remotely. It all depends how your hosting company setup teh privilegs. Remember to enter the IP address or hostname of the remote machine connecting, to the access hosts list in the MySQL manager in your control panel.
- 06-08-2005, 01:22 PM #2
WHC Guru
- Join Date
- Oct 2004
- Location
- http://kooshin.com
- Posts
- 4,201
And you can leave the password field blank I guess and the user name is root most of the time
█ For Reliable and Affordable Web Hosting Packages, Please visit kooshin.com
█ KooshinDesigns.com- Version One Online
█ ArticleStorage.com- Your #1 Resource For Articles
█ 4Ulyrics.com -- The Lyrical Hideout, For Sale - Email me for details.
- 01-03-2006, 06:45 AM #3
Addict
- Join Date
- May 2005
- Posts
- 340
What would the Remote Address be though?
- 01-06-2006, 10:05 PM #4hostmedic Guest
google it . . . .
On system A, follow these steps:
1.
Start the MySQL server.
2.
Use GRANT to set up an account with a username of myuser that can connect from system B using a password of myuser:
GRANT ALL ON *.* to 'myuser'@'B' IDENTIFIED BY 'mypassword';
3.
The GRANT statement grants all privileges to user myuser for connecting from system B using the password mypassword. To execute this statement, you should be either root on system A (or another user who has appropriate privileges). For more information about MySQL privileges, refer to Section 5.8, “MySQL User Account Management”.
On system B, follow these steps:
1.
Configure a MyODBC DSN using the following connection parameters:
DSN = remote_test
SERVER or HOST = A (or IP address of system A)
DATABASE = test (The default database or an appropriate one)
USER = myuser
PASSWORD = mypassword
To set up a DSN-less connection, refer to Section 23.1.9.5, “Connecting Without a Predefined DSN”. on the mySQL website...
2.
Check whether you are able to access system A from system B by using ping or other means. If you are not able to reach system A, check your network or Internet connections or contact your system administrator.
3.
Try to connect using DSN=remote_test. If it fails, trace the MyODBC log, and take the further steps based on the error message from the log.
Hope that helps
- 01-06-2006, 10:08 PM #5hostmedic Guest
On Unix, you configure DSN entries directly in the odbc.ini file. Here is a typical odbc.ini file that configures myodbc and myodbc3 as the DSN names for MyODBC 2.50 and MyODBC 3.51, respectively:
;
; odbc.ini configuration for MyODBC and MyODBC 3.51 drivers
;
[ODBC Data Sources]
myodbc = MyODBC 2.50 Driver DSN
myodbc3 = MyODBC 3.51 Driver DSN
[myodbc]
Driver = /usr/local/lib/libmyodbc.so
Description = MyODBC 2.50 Driver DSN
SERVER = localhost
PORT =
USER = root
Password =
Database = test
OPTION = 3
SOCKET =
[myodbc3]
Driver = /usr/local/lib/libmyodbc3.so
Description = MyODBC 3.51 Driver DSN
SERVER = localhost
PORT =
USER = root
Password =
Database = test
OPTION = 3
SOCKET =
[Default]
Driver = /usr/local/lib/libmyodbc3.so
Description = MyODBC 3.51 Driver DSN
SERVER = localhost
PORT =
USER = root
Password =
Database = test
OPTION = 3
SOCKET =
- 01-06-2006, 10:17 PM #6hostmedic Guest
via php
mysql_connect
(PHP 3, PHP 4, PHP 5)
mysql_connect -- Open a connection to a MySQL Server
Description
resource mysql_connect ( [string server [, string username [, string password [, bool new_link [, int client_flags]]]]] )
Opens or reuses a connection to a MySQL server.
Parameters
server
The MySQL server. It can also include a port number. e.g. "hostname
ort" or a path to a local socket e.g. ":/path/to/socket" for the localhost.
If the PHP directive mysql.default_host is undefined (default), then the default value is 'localhost:3306'
username
The username. Default value is the name of the user that owns the server process.
password
The password. Default value is an empty password.
new_link
If a second call is made to mysql_connect() with the same arguments, no new link will be established, but instead, the link identifier of the already opened link will be returned. The new_link parameter modifies this behavior and makes mysql_connect() always open a new link, even if mysql_connect() was called before with the same parameters.
client_flags
The client_flags parameter can be a combination of the following constants: MYSQL_CLIENT_SSL, MYSQL_CLIENT_COMPRESS, MYSQL_CLIENT_IGNORE_SPACE or MYSQL_CLIENT_INTERACTIVE. Read the section about Table 2 for further information.
and alsoPHP Code:<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>
more available online: http://us2.php.net/function.mysql-connectPHP Code:<?php
// we connect to example.com and port 3307
$link = mysql_connect('example.com:3307', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
// we connect to localhost at port 3307
$link = mysql_connect('127.0.0.1:3307', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>



LinkBack URL
About LinkBacks




Reply With Quote






Bookmarks