Building MySQL from Sources on Ubuntu

This documentation is going to tell you how to install and configure MySQL 5.6.19 from sources on Ubuntu.

1. Install cmake tools.

2. Download and extract MySQL source codes.
Download page:

3. cmake and install

4. fix errors


CMake Error: your CXX compiler: “CMAKE_CXX_COMPILER-NOTFOUND” was not found.

Warning: Bison executable not found in PATH

Googlemock was not found. gtest-based unit tests will be disabled. You can run cmake . -DENABLE_DOWNLOADS=1 to automatically download and build required components from source.

c++: internal compiler error: Killed (program cc1plus):  You need at least 1G RAM.

5. Start MySQL service

mysql_install_db: after MySQL 5.6.8 mysql_install_db is a perl and can be used on any system that installed perl. but before 5.6.8 it is a shell script and is available only on *nix(unix/linux) platforms. mysql_install_db initializes the MySQL data directory and creates the system tables, if they don’t exist.

mysqld_safe: is the recommended way to start a mysqld server on *nix. mysqld_safe adds some safety features such as restarting the server when an error occurs and logging runtime information to an error log file.

6. Set password for the root user

Then you can log into MySQL as root user using following commands:

7. Start & Stop MySQL Service
You can use “ps aux | grep mysql” to check if the MySQL service is running.

Then try the following commands to stop MySQL server.

Start MySQL server


Leave a Reply

Your email address will not be published. Required fields are marked *