3 messages in com.mysql.lists.win32Accessing MySQL Server from Linux <> ...| From | Sent On | Attachments |
|---|---|---|
| miguel solórzano | 10 Sep 2000 05:58 | |
| Jonah H. Harris | 10 Sep 2000 09:33 | |
| John Dean | 10 Sep 2000 12:02 |
| Subject: | Accessing MySQL Server from Linux <> Win Machines![]() |
|---|---|
| From: | miguel solórzano (mig...@mysql.com) |
| Date: | 09/10/2000 05:58:25 AM |
| List: | com.mysql.lists.win32 |
Hi!
The main problem to access a MySQL Server from a Win machine to Linux Machine or vice versa, is the authentication process by the side of Win machine which use an encryption password.
The instructions below can be a quite different according with your OS version and hardware, e.g. older versions of Win95 uses a password plain text authentication, now the Win98, the NT and Win 2000 machines are using the encryption password. Anyway we hope that this instruction take you in the right direction.
IMPORTANT The instructions here are based in several SAMBA documents, so all the rights reserved to the authors and many thanks to Samba Team.
We are assuming that you have knowledge of:
- The configuration of local network - How works the MySQL privileges system
Also, the sample is based in a Windows 2000 Server as domain and a Linux Mandrake 7.0 workstation.
The Windows machine has an IP number: 192.168.0.1 and the Linux Machine and IP number of 192.168.0.75, both with a sub net mask of 255.255.255.0
To be sure that your network is up, make the first test which consists in a simple ping. e.g. We make a ping from the Linux machine:
ping 192.168.0.1 (192.168.0.1): 56 data bytes 64 bytes from 192.168.0.1: icmp_seq=0 ttl=128 time=0.5 ms 64 bytes from 192.168.0.1: icmp_seq=1 ttl=128 time=1.5 ms 64 bytes from 192.168.0.1: icmp_seq=2 ttl=128 time=0.4 ms 64 bytes from 192.168.0.1: icmp_seq=3 ttl=128 time=1.5 ms 64 bytes from 192.168.0.1: icmp_seq=4 ttl=128 time=0.4 ms 64 bytes from 192.168.0.1: icmp_seq=5 ttl=128 time=1.5 ms 64 bytes from 192.168.0.1: icmp_seq=6 ttl=128 time=0.4 ms 64 bytes from 192.168.0.1: icmp_seq=7 ttl=128 time=1.5 ms
--- 192.168.0.1 ping statistics --- 8 packets transmitted, 8 packets received, 0% packet loss round-trip min/avg/max = 0.4/0.9/1.5 ms
If you see something as above. For now, all is OK.
Now you need to prepare the installation (if you don't have yet this version installed) of the package Samba 2.0.7 or later. From this version you have in hands the encryption support of Samba stuff for Win Machines.
Then, take a look in your Linux machine, what version of Samba is already installed. If necessary, of course, you should download it from a good mirror of www.samba.org. If you don't find a binary package, you should need the gcc compiler package installed in your computer; then take a look for it and if necessary make the installation from your Linux CD using the RPM manager. In our case we had download the package samba-2.0.7-20000425.src.rpm. Put the package in any temporary directory and with the RPM manager, install the package e.g. /usr/local directory.
Close the RPM manager and go to the samba-2.0.7 directory. Into this directory you should find another directory named usr/local/samba-2.0.7/packaging. Enter in this directory using a console screen and search for the directory of your Linux package. In our case the RedHat package. Now see the README file instructions to build the RPMS:
sh makerpms.sh
Wait while the compiler works for you.
In the end of the process, the script should send the message of the directory destination e.g.: /usr/src/RPM/RPMS/i586
Before the installation, remove (if necessary) the older Samba version, to avoid conflicts during the installation. Using the RPM manager install the new Samba stuff.
The next step is the adding of the users and group in both machines.
In our sample the domain Win 2000 is called PT2.
In the Linux machine create the directory:
/usr/local/samba/private
and to generate the smbpasswd file from your /etc/passwd file use the following command:
cat /etc/passwd | mksmbpasswd.sh >/usr/local/samba/private/smbpasswd
If you are running on a system that uses NIS, use
ypcat passwd | mksmbpasswd.sh >/usr/local/samba/private/smbpasswd
Set the owner of the directory for the root with the command
chmod 500 /usr/local/samba/private
and set the permission to the file with the command:
chmod 600 smbpasswd
If you want to know more about the steps above, read the encryption.txt of the Samba documentation.
If the Win machine is the domain as our sample, stop the samba server and joining to the domain with the command:
smbpasswd -j PT2 -r PT2
PT2 is the name and NETBIOS of the Win machine. If you see a response like:
Joined domain PT2.
All is ok.
Now, before restarting the Samba server you should edit your /etc/smb.conf file to tell Samba it should now use domain security:
line in the [global] section of your smb.conf:
security = domain
workgroup = PT2
encrypt passwords = yes smb passwd file = /usr/local/samba/private/smbpasswd
If you want to know more about the steps before, read the domain member.txt from the Samba documentation.
On another hand if your Linux machine is the domain, you need to read the documentation called domain.txt to definite the Linux domain and left the lines about the encryption the same.
There are two important files in your /etc directory. The host and the lmhost. Edit the file with lines like:
host file
127.0.0.1 localhost.localdomain localhost # 0 192.168.0.75 linux 192.168.0.1 pt2
lmhost file
127.0.0.1 localhost 192.168.0.75 linux 192.168.0.1 pt2
Now restart the samba server.
In this point, the encryption issue is already resolved.
Now run the MySQL server and the client and grant the privilege to the user of the another machine with a command (a sample):
mysql>GRANT ALL PRIVILEGES ON *.* TO username@"%" IDENTIFIED BY 'password' WITH GRANT OPTION;
From the other machine using the MySQL client:
mysql -u username -ppassword -h theotherhostname_or_ipnumber
You can also to make in a Win machine a DSN file to MyODBC driver filling the fields with values above.
Good luck.
Regards, Miguel
+----------------------------------------------------------------------+ | TcX ____ __ _____ _____ ___ MySQL AB | | /*/\*\/\*\ /*/ \*\ /*/ \*\ |*| Miguel A. Solórzano | | /*/ /*/ /*/ \*\_ |*| |*||*| mailto:mig...@mysql.com | | /*/ /*/ /*/\*\/*/ \*\|*| |*||*| São Paulo - Brazil | | /*/ /*/ /*/\*\_/*/ \*\_/*/ |*|____ | | ^^^^^^^^^^^^/*/^^^^^^^^^^^\*\^^^^^^^^^^^ | | /*/ \*\ Developers Team | +----------------------------------------------------------------------+




