Install MySQL 5.7.5-m15 on Ubuntu Server 14.04 LTS from Source

Source: Internet
Author: User

This post documents the steps of installing MySQL from source code, and the resolutions to serveral issues in installing. The steps here's specific to 64-bit Ubuntu 14.04.1 LTS, and MySQL source code is 5.7.5-m15. But I think most of the them can also work on your system.

Download MySQL Source Code

wget http://dev.mysql.com/get/downloads/mysql-5.7/mysql-5.7.5-m15.tar.gz


Install Gcc/g++/make/cmake

If your system has not installed Gcc/g++/make/cmake yet, please install them first. The following commands should is able to get your system installed correct and proper versions.

Install updateapt Install GCC Apt install g++aptinstallmakeaptinstall cmake Cmake-gui

Other dependencies

If the system prompts "Curses library not found. Please install the appropriate package, remove CMakeCache.txt and rerun CMake. On Debian/ubuntu, package name was Libncurses5-dev, on Redhat and derivates it was ncurses-devel." When you execute "cmake.", click Run apt-get to install the library.

Install Libncurses5-dev

If the error "Bison executable not found on PATH.", please run the command below.

Install Bison


Install MySQL

#groupadd Mysqluseradd-R-g MySQL mysql#TarZXVF mysql-version.Tar. GZCD MySQL-Version#cmake.-ddownload_boost=1-dwith_boost=/root/boost-denable_downloads=1 Make Make Install#cd/usr/local/MySQLChown-R MySQL.chgrp-R MySQL. # from5.7.5, the--datadir option is Mandatory.bin/mysql_install_db--datadir=/usr/local/mysql/data#Chown-R root.Chown-R MySQL Data # Open the MySQL configfileVI/etc/mysql/my.cnf

The default values of Basedir, DataDir, and Lc-message-dir to the following values.

Basedir  = /usr/local/mysqldatadir  = /usr/local/mysql/datalc-messages-dir =/usr/local/mysql/share # This setting would avoid the error "[ERROR] Can ' t ' find error-message file '/usr/share/mysql/errmsg.sys '". 

If your MySQL log is under/var/log/mysql, please execute the following commands. The commands would prevent the error "touch:cannot touch/var/log/mysql/error.log:no such file or directory" from happening when you run "bin/mysqld_safe--user=mysql &".

mkdir /var/log/mysqlchown -R mysql:mysql/var/log/mysql

Run Mysqld_safe to try to start MySQL. Don ' t omit the ' & '. :-)

Bin/mysqld_safe--user=mysql &

If you see the following errors In/var/log/mysql/error.log, OPEN/ETC/MYSQL/MY.CNF and edit the variables like below.

[ERROR] Unknown variable ' key_buffer=16m '

VI/ETC/MYSQL/MY.CNF, change 'key_buffer=16m' to 'key_buffer_size=16m'.

[ERROR] Unknown variable ' myisam-recover=backup '

Comments out this line 'myisam-recover=backup' in/etc/mysql/my.cnf with a ' # '.

Reset password for root

First, you need login to MySQL server with the random password generated by mysql_install_db. You can find the password in the File/root/.mysql_secret.

/usr/local/mysql/bin/mysql-u root-p

Then, use Set Password statement to set new Password.

mysql> Set Password = password ('your password');

ADD MySQL Server executables to System PATH

Create a file mysql.sh under /etc/profile.d/ directory,

Touch /etc/profile.d/mysql. SH VI /etc/profile.d/mysql. SH

and add the following lines to the file.

#!/bin/bashifecho ${path} | /bin/grepthenPATH=/usr/local/mysql/bin:${path}fi

Use the following command to add the path to the current shell.

Source/etc/profile.d/mysql. SH

Use echo $PATH to check if the script works. "/usr/local/mysql/bin" should is in the output.

Echo $PATH

ADD MySQL Server libraries to the shared library cache

Touch /etc/ld. so.conf.d/mysql.confecho"/usr/local/mysql/lib  " >/etc/ld. so.conf.d/mysql.confldconfig

Set MySQL Server Service

CP support-files/mysql.server/etc/init.d/mysqlservice mysql start


Install MySQL 5.7.5-m15 on Ubuntu Server 14.04 LTS from Source

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.