Install mysql 5.5 from source

I got a request from  one of my clients  to setup a mysql server with the latest version.  I decided to install mysql using source , because i always love compilation 🙂

As usual I downloaded the latest source and fired the command ” ./configure ”  with options . But the result was not good 🙁


=>> Download the latest MySql source

=>> Configure ( Old Story )

1)  tar -zxf mysql-5.5.15.tar.gz
2)  cd mysql-5.5.15
3)  ./configure
./configure: command not found

( After some goggling , i found  ”  In MySQL 5.5 onwards , CMake is used as the build framework on all platforms. ” )


=>> Download and install cmake

$  wget
$  tar zxvf cmake-2.8.5.tar.gz
$  cd cmake-2.8.5
$  yum install gcc-c++
$  ./configure
$  make
$  make install


=>> Configure ( New Story )

$ cd mysql-5.5.15

$  Configure using cmake

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql5 -DMYSQL_TCP_PORT=3306  -DMYSQL_UNIX_ADDR=/tmp/mysql.sock 

— Could NOT find Curses (missing:  CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline.cmake:83 (MESSAGE):
Curses library not found.  Please install appropriate package,

$ yum install ncurses-devel

rm -f  CMakeCache.txt   ( Equivalent to ” make clean ”  )

$  Again run the cmake command after fixing the curses error.

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql5  -DMYSQL_TCP_PORT=3306  -DMYSQL_UNIX_ADDR=/tmp/mysql.sock 

more cmake configuration options here :  cmake options

$  make

$ make install


=>> Post installation Steps

$  cp support-files/my-medium.cnf   /etc/my.cnf

$  cp support-files/mysql.server   /etc/init.d/mysql

$  chown -R mysql:mysql .

$  ./scripts/mysql_install_db  – -user=mysql  – -datadir=/var/lib/mysql

$  /etc/init.d/mysql restart

$  ./bin/mysqladmin -u root password ‘new-password’

$  ./bin/mysql_secure_installation

Thats its you installed mysql 5.5 successfully. You can configure / optimize the mysql using the my.cnf file .


=>> Test the insatalation

$ mysql -u root -p

> create table new ;

Hope that this will be helpful for someone worrying with ” ./configure command not found ” in mysql latest version.

How to reset mysql root password : click here 🙂

  • BiBi

    Thanks, I love you very much.

  • john

    this was a huge help and the only specific examples code wise on how to install curses …get past that error

    i made it all the way to this step and got this error …. could you tell me how to solve error ..i’m totally new to this type of installation so if you could give me the exact command to paste that would be huge i’ve tried to find the answer elsewhere already for quite a long time

    this is where i get to
    $ ./scripts/mysql_install_db – -user=mysql – -datadir=/var/lib/mysql

    FATAL ERROR: Could not find ./bin/my_print_defaults

  • admin

    Hello John ,

    Thank you for referring my forum .

    From the given error its seems that , mysql install script is not able to find the “my_print_defauls ” binary .

    You can troubleshoot the issue as follows

    # which my_print_defaults

    ( In my case its under /usr/local )

    So please change the mysql install command accordingly ( for my case it will be as follows )

    # $ ./scripts/mysql_install_db – -user=mysql – -datadir=/var/lib/mysql –basedir=/usr/local

    Hope that this will help to fix your issue .