summaryrefslogtreecommitdiff
path: root/doc/data-from-remote-mysql-server.txt
blob: 21019cfc926197806caeaa6d027a25114d1cccf1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
	 Connecting to MySQL server on a remote machine using ODBC
     ---------------------------------------------------------
    It will be a good idea to read "using-mysql-databases.txt" before reading this document.
    
1.  Configuring MySQL Server.

    No idea, what is the default nature of mysql binding ! I think the default binding is to 
    localhost. So its good idea to add a attribute to be on a safer side :). Do not complain 
    me later that, it was not told ;)
    
    # vi /etc/my.conf
    
        Search for [mysqld]. In this section add attribute
        bind-address=<your-machine-ip-addr-or-domain-name>
    
    1.1 Grant permission to remote user
    
        enter into mysql
    
        #mysql -u root -p 
        #mysql> use <your-database1>
        #mysql> GRANT ALL PRIVILEGES ON <your-table-name/database-name/*>.* TO \
            'remote-user'@'remote-domain' IDENTIFIED BY 'put-ur-passwd';
    
        The privileges can be given to "database" or "table in a database" or "*" all !!
    
    1.2 Test it

        Use another machine having mysql client.
        # mysql -h <your-machine-ip-addr-or-domain-name> -u remote-user -p

        <your-machine-ip-addr-or-domain-name>:Put the ip address or domain name where the server is 
        running.
        remote-user: The user name which is permitted(granted) from this machine to use the 
        database.
        -p : Prompts the password. type the password given at the time of GRANT.

        If you are able to see "#mysql>" prompt its a success.

    
2.  Connecting to MySQL with ODBC Driver

    2.1 Configure the ini file.
    
         #vi /etc/unixODBC/odbc.ini

         Add the entries as follows:
         [MySQL-test]
         Description = abc
         Driver      = MySQL
         Server      = mysqlserver.com //or the ip address where MySQL Server is running
         User        = mjayant //remote user
         Password    = abcd //clear password
         Database    = test //database name
         Port        = 3306 //port number

         * Please do not put the comment the "above" way. That was context sensitive comment ;) 
         (Saves effort and space)

         For some unknown reason the User and password does not work.

    2.2 Test the driver.
        
        #isql  MySQL-test mjayant abcd

        if this gives you "SQL>" prompt you are done :)

         
3.  Connecting with OOo to remote server.

    Use the same steps written in section 3.1 of doc/using-mysql-databases.txt :)