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

This post documents the steps of installing MySQL from source code, and the resolutions to serveral issues in installing. The steps here are specific to 64-bit Ubuntu 14.04.1 LTS, and MySQL source code is 5.7.5-m15. But I think most of 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 be able to get your system installed correct and proper versions.

apt-get install update
apt-get install gcc
apt-get install g++
apt-get install make
apt-get install cmake cmake-gui

Other dependencies

If the system prompts "Curses library not found.  Please install appropriate package, remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel." when you execute "cmake .", please run apt-get to install the library.

apt-get install libncurses5-dev

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

apt-get install bison

Install MySQL

#
groupadd mysql
useradd -r -g mysql mysql

#
tar zxvf mysql-VERSION.tar.gz
cd mysql-VERSION

#
cmake . -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/root/boost -DENABLE_DOWNLOADS=1
make
make install

#
cd /usr/local/mysql
chown -R mysql .
chgrp -R mysql .

# from 5.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 config file
vi /etc/mysql/my.cnf

Change the default values of basedir, datadir, and lc-message-dir to the following values.

basedir  = /usr/local/mysql
datadir  = /usr/local/mysql/data
lc-messages-dir = /usr/local/mysql/share # this setting will 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 will 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/mysql
chown -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 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/bash

if ! echo ${PATH} | /bin/grep -q /usr/local/mysql/bin ; then
PATH=/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 be in the output.

echo $PATH

Add MySQL Server libraries to the shared library cache

touch /etc/ld.so.conf.d/mysql.conf
echo "/usr/local/mysql/lib" > /etc/ld.so.conf.d/mysql.conf
ldconfig

Set MySQL Server service

cp support-files/mysql.server /etc/init.d/mysql
service mysql start
时间: 2024-10-07 09:34:00

Install MySQL 5.7.5-m15 on Ubuntu Server 14.04 LTS from Source的相关文章

Install MySQL 5.7.5-m15 on Ubuntu Server 14.04 LTS

Install libaio MySQL depends on the libaio library. If you have not the libaio installed on your system, then install it first. apt-get install libaio1 If the command above prompts that you need insert the disc labled "Ubuntu Server 14.04 LTS ...&quo

ubuntu server 14.04 LTS下搭建LAMP环境之最详细笔记之一U盘安装双系统

前言: 一直在WIN上使用PHP,不喜欢用WAMP,每次都是手动在windows配置环境,偶尔有一次装了小红帽玩了两天,感觉不是很习惯就换了回来,过了没几天见讨论LAMP环境,于是安装了ubuntu的desktop版本.安装好了环境使用了一下感觉也没有多大的意思,因为那一段时间没有怎么使用PHP,就这样又忽略掉了这一次学习的机会,直到上周日朋友最近在学习这方面的知识,说是要将一个老式电脑安装一个linux来玩玩.本文原创博客地址:http://www.cnblogs.com/unofficial

Ubuntu Server 14.04 LTS(64bit)下安装 weblogic Server 12c(12.1.3) Zip Distribution

这里说下关于在Ubuntu Server 14.04 LTS(64bit)下安装weblogic Server 12c(12.1.3) Zip Distribution遇到的问题.至于Windows环境下的安装没什么好说的,只要你根据wls1213_dev.zip中自带的README.TXT一步步做,是不会出现问题的.但是对于在一个干净的Ubuntu Server下的来说,根据向导的说明你是装不起来的.因为它缺少了必要的环境设置,也许这对于linux下的老手来说这些都不是事. 当在安装中遇到问题

ubuntu server 14.04 LTS 图形化安装

陈科肇 ================ 1.开始进行用户界面的安装 # apt-get  install xinit 2.安装环境管理器 # apt-get install gdm 3.安装桌面环境 # apt-get install kubuntu-desktop 4.重启 界面安装成功! 注: 1.如果不成功,出现"unable to locate package gnome-core"或"ubuntu server 14.04E:Package 'rpm' has n

ubuntu server 14.04 LTS 安装图形界面

进入系统之后,开始进行用户界面的安装.首先输入如下命令: sudo apt-get install xinit 述安装完毕之后,再安装环境管理器.本人亲测安装的是GNOME.使用如下命令安装: sudo apt-get install gdm 然后,安装桌面环境.本人亲测安装的是KUbuntu.安装命令如下: sudo apt-get install kubuntu-desktop  //这个执行时间最长,有可能会超过1个小时 上述安装完毕之后,直接重启.重启完成后,再进入系统,便是图形界面了

Ubuntu server 14.04 LTS 多网卡绑定实现负载均衡

将两张网卡绑定,共用一个IP,实现冗余效果.实际上linux双网卡的绑定模式有7种: mode=0 表示 load balancing (round-robin)为负载均衡方式,两块网卡都工作. mode=1 表示 fault-tolerance (active-backup)提供冗余功能,工作方式是主 从的工作方式,也就是说默认情况下只有一块网卡工作,另一块做备份. mode=2 表示 XOR policy 为平衡策略.此模式提供负载平衡和容错能力 mode=3 表示 broadcast 为广

Linux Ubuntu Server 14.04 LTS 处理中文乱码及vi编辑器操作概要

首先在网上搜了一些资料,说是暂时无法解决. 但在安装的时候选择的是中文安装,因此在命令页面显示的是方格的乱码. 既然是Linux 服务版,我想就没必要去安装中文包了吧,决定换回英语显示. ================ 1.使用命令cd etc/default 切换到这个目录下,然后修改locale文件里的内容: 2.要修改locale文件,普通用户的权限是不够的,那怎么办呢,使用sudo 命令,在默认情况下,可以得到5分钟的root权限,即:sudo vi locale: 这样就进入vi编辑

如何为ubuntu server 14.04 安装图形界面

buntu(乌班图)是一个以桌面应用为主的Linux操作系统,其名称来自非洲南部祖鲁语或豪萨语的"ubuntu"一词,意思是"人性"."我的存在是因为大家的存在",是非洲传统的一种价值观,类似华人社会的"仁爱"思想.Ubuntu基于Debian发行版和GNOME桌面环境,与Debian的不同在于它每6个月会发布一个新版本.Ubuntu的目标在于为一般用户提供一个最新的.同时又相当稳定的主要由自由软件构建而成的操作系统.Ubun

Install LEMP (Linux, Nginx, MySQL and PHP) Stack on Ubuntu Linux 14.04 LTS(转)

Install LEMP (Linux, Nginx, MySQL and PHP) Stack on Ubuntu Linux 14.04 LTS Nginx Installation Nginx is one of the robust web server in Linux world. Nginx is a free, open source, high performance HTTP server and reverse proxy, as weell as an IMAP/POP3