How to

Compile MySQL in Ubuntu
For some reasons you may need to compile mysql server from the source in linux. in our case ubuntu. Below is a simple tutorial to acheive that. Ubuntu 14.04 and MySQL server 5.6 has been used
    • Pre-installation:
      • Make sure you install cmake, build-essential and bison
    • Go to http://dev.mysql.com/downloads/mysql/ and choose Source Code from the selection, then download Generic Linux (Architecture Independent), Compressed TAR Archive, which normally is at the bottom of list of files to download from.
      • On terminal, cd to download folder
      • sudo tar xvzf mysql* -C /usr/local/src
        Now, files are unzipped in /usr/local/src
      • cd /usr/local/src/mysql*
      • To compile the MySQL source, there are lot of options you can choose when configuring your server, you can get more info from mysql website, some of these:
        sudo cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DWITH_INNOBASE_STORAGE_ENGINE=1 -DDEFAULT_CHARSET=utf8 -DFEFAULT_COLLATION=utf8_general_ci -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DSYSCONFDIR=/etc
        Most of these are self-explanatory, and make sure you do these commands at one go.
      • sudo make install
    • Post-installation
      • sudo addgroup --system mysql then add user by typing
        sudo adduser --system mysql --no-create-home -ingroup mysql
      • cd /usr/local/mysql
      • cd /usr/local/mysql
      • sudo chown -R root .
      • sudo chown -R mysql:mysql data
      • sudo scripts/mysql_install_db --user=mysql
      • sudo cp support-files/my*.cnf /etc/my.cnf
      • sudo cp ./support-files/mysql.server /etc/init.d/mysql.server
      • sudo chmod +x /etc/init.d/mysql.server
      • For simplicity use defaults to start/stop
        sudo update-rc.d mysql.server defaults
      • Now start the server
        sudo ./bin/mysqld_safe &
      • Now check if its running ps -e | grep mysql* , you will see process numbers as well as the owner
      • To secure your server
        sudo ./bin/mysql_secure_installation and follow instructions
      • Other programs to find its libraries, elevate the user as a root
        sudo -i
        sudo echo "/usr/local/mysql/lib/" >> /etc/ld.so.conf
        sudo ldconfig
      • To check libraries
        ldconfig -p | *mysql*
    Now, our mysql server is compiled and configured to start when our ubuntu box starts. Hope you enjoyed this simple "How To" tutorial.

Comments (0)

Add a Comment

-->

How to

PHP Programming
PHP Class for MySQL (for beginners)
Hard Disk
Clone Hard Disk with different sector size

Products

We have ready-made CMS sytems that can be edited to suit your needs. We gurantee that our sytems can be administered or managed by most people who have basic IT knowledge. Also, we have
  • Applications and software for specialised domains and tasks
  • New and used Computers and laptops