2

Here is the technical description.

My laptop's config:

  • IP Adress:192.168.2.5
  • MySQL Server 5.0 on port 3306
  • Operating System: Ubuntu
  • The database is in this machine

My friend's laptop config:

  • IP Adress:192.168.2.4
  • MySQL Server 5.0 on port 3306
  • Operating System: Windows XP

Both are on a wireless LAN connected through a Belkin router (192.168.2.1). I put this but its not working:

url = "jdbc:mysql://192.168.2.5:3306/Database"

How can I configure things connect to this database?

1
  • Questions about home networks and personal computers are off-topic per the faq
    – MDMarra
    May 31, 2012 at 12:59

3 Answers 3

1

MySQL is a TCP protocol running on port 3306 by defauly, hence there is nothing special beyond ensure that you have enabled binding to a public IP address in the /etc/my.cnf file;

port            = 3306
bind-address            = 0.0.0.0

On the client you would need to install the jdbc drivers for MySQL;

For windows XP they can be downloaded from here;
http://dev.mysql.com/downloads/connector/j/

For ubuntu, there are package version in the repository;

# aptitude search mysql | grep JDBC
p   libmysql-java                   - Java database (JDBC) driver for MySQL 

You can use any client, mysql provide a workbence tools product;
http://dev.mysql.com/downloads/workbench/5.2.html

or you can use Libreoffice and their database connection to view the tables;
http://www.libreoffice.org/features/base/

Or use a scripting language like php;
http://php.net/manual/en/book.mysql.php

or even just the command line client;

$ mysql -h192.168.2.5 -uuserXXX -e "show databases;"
+--------------------+
| Database           |
+--------------------+
| information_schema | 
| badger1             | 
| cacti              | 
3
  • thank you very much for your answer. my friend can access to my database in windows xp but my goal is to access to ** his database in ubuntu**. i have windows xp
    – waelbk
    May 31, 2012 at 13:03
  • how do you wish to access it?, is the database already running in Ubuntu, or do you need to install it?
    – Tom
    May 31, 2012 at 13:33
  • 1
    $ mysql -u root -p Enter password: mysql> use mysql mysql> GRANT ALL ON . to root@'192.168.2.4' IDENTIFIED BY 'your-root-password'; mysql> FLUSH PRIVILEGES;
    – waelbk
    May 31, 2012 at 19:23
0

This might sound stupid but have you checked if your Ubuntu machine has its firewall running? That has tripped me up a few times on both Windows and Linux.

A quick check is to run: sudo iptables -L

Here is a how-to from the ubuntu site: https://help.ubuntu.com/community/IptablesHowTo

0

Have you configured remote access for your MySQL server ? If not, read this.

You must log in to answer this question.