Category Archives: mysql

CentOS 6.x and Microsoft SQL Server ODBC Linux driver

Some days ago in my company someone asked me if we can access to our ERP software which is using Microsoft SQL Server. They want to get data to program which is writing by me using PHP and MySQL. I started to googling the net but I only found that Microsoft is providing drivers for ODBC connection. Those drivers can be found here.

Here is what i have done: (I assume that you have LAMP server setup on your CentOS 6.x)

Next step was to download proper driver: For CentOS 5.x

For CentOS 6.x

Next I have to untar it

and then build it

After that:

And the last

Now I have to setup ODBC, so we have to edit /etc/odbc.ini file and setup proper DSNName values

To test it I have to use the isql command

I have seen something like this below

OK, now it’s time to test PHP connection – because this is what my cooworkers wanted. So let’s wrote some PHP code:

I save it under odbctest.php file. Now it’s time to test it in the linux terminal:

I have seen something like:

Which was good. Now it’s time to test it under Apache, so a I copied this odbctest.php file under /var/www/html

After that i run

the download seems not working. The problem was in selinux permissions. If I do

then wget command will work and my webpage was accessible – until next reboot. Another way was to change the semanage context

Now after reboot it was working 🙂

Important information!

In CentOS 7 all steps will work until →# php odbctest.php. The problem is that Microsoft does’nt provide driver for RHEL/CentOS 7 branch. It only works with PHP up to 5.4 🙁

CentOS 6.x Apache, MySQL and PHP Installation

Installing LAMP (Linux, Apache, MySQL, PHP) is very easy on CentOS 6.x. You should only do something like:

Don’t forget to open port 80 in /etc/sysconfig/iptables by adding

That’s all folks!


I forgot to write one thing – you have to start & enable httpd service to start during restarts 😉

CentOS 6.x MySQL simple configuration

I know that there is many information on the internet about how to install and configure MySQL Server, but I want to have that information on my site also. So let’e begin 🙂

First we have to do the install:

# yum install mysql mysql-server

After that we can run:

# mysql_install_db

then we shall give password for user root in mysql. We can do that in two ways, first:

# /usr/bin/mysqladmin -u root -p ‘secretpass’

second ways is to login into mysql

# mysql -u root

and under mysql shell we should do this:

mysql> set password for ‘root’@’localhost’ = password(‘secretpass’);

And voila – we have done a simple MySQL Server configuration.

Now we have to start the mysqld deamon:

# chkconfig –level 2345 mysqld on
# service mysqld start

That’s all.

MySQL Workbench in CentOS

During my work on my latest project which is using MySQL database, allmost all work with databases, tables etc. I was doing using the linux terminal. A few days ago while reading some IT newspaper I have found a review of a MySQL Workbench. After that I was looking if that piece of software is available in my distro (CentOS). I didn’t found it (maybe I don’t have all repos in my linux ;)). So i decided to download it from MySQL website (here).
I Was looking if there were packages for my distro, but the only suitable was RedHat/Oracle Linux :(. So I decided to downloand it. After that – as root user – I’ve done standard command:

# rpm -ivh mysql-workbench-gpl-5.2.38-1el6.i686.rpm

But I’ve got error that two libraries was missing in my linux:

  • libzip,
  • pexpect

so the

# yum install libzip pexpect

command done the work.

After that the rpm command installed the MySQL Workbench. And below are screenshots of that software 🙂