Monday, August 22, 2011

Reverse engineer MySQL Database on Linux to Windows Visio

Reverse engineering a database can be fun, especially when someone needs it in Microsoft and you're working on Linux. MySQL generates tools that will reverse engineer databases with their workbench product, but there are lots of people who like documenting in Microsoft, so here's how to connect your Windows system to a Linux MySQL database.

1. Make sure, or install the following packages on your Linux MySQL server;
- mysql-connector-odbc
- unixODBC

yum -y install mysql-connector-odbc unixODBC

2. Edit the file /etc/odbcinit.ini
This file should be OK from the point of install pointing to the correct shared objects;
e.g.
[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/libmyodbc5.so
Setup = /usr/lib/libodbcmyS.so
Driver64 = /usr/lib64/libmyodbc5.so
Setup64 = /usr/lib64/libodbcmyS.so
FileUsage = 1

3. Edit the /etc/odbc.ini will need to have information to connect to your database, replace italics with your details;
[nameOfDB]
driver = MySQL
Database = yourDBName
Server = localhost
Socket = /var/lib/mysql/mysql.sock
User = yourDBconnectUser
Password = youDBconnectPassword

4. Edit the /etc/my.cnf file and add the bind-address of your external IP;
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
symbolic-links=0
bind-address=yourServerIP

5. Now we need to give access to your database user specified as yourDBconnectUser in step 3;
- Log in to the mysql database
- GRANT ALL on yourDatabase.* to yourDBconnectUser@'yourServerIP' IDENTIFIED BY 'youDBconnectPassword';

6. Now configure your Windows system ODBC MySQL connector to point to this database;
- This requires you to download the MySQL ODBC Connector from MySQL
- You will need to use the IP Address, Username, Password and Database configured above to connect to the Database.

No comments:

Post a Comment