Table of Contents
环境简介
MySQL5.6.30安装
前期准备
创建mysql用户与mysql组
创建mysql文件夹于数据存放文件夹data
安装cmake
安装信息配置
执行make && make install
进行相应的配置
初始化mysql
启动与关闭mysql
连接mysql
mysql安装好之后的目录结构
安装可能遇到问题解决
问题1
yum -y install libtool
autoreconf –force –install
libtoolize –automake –force
automake –force –add-missing
问题二
问题三
Home Database Mysql Tutorial Linux下源码安装MySQL5.6.30_MySQL

Linux下源码安装MySQL5.6.30_MySQL

May 27, 2016 pm 01:45 PM
Source code

环境简介

linux :cenos 6.5
mysql版本:mySQL5.6.30
Mysql5.6.30安装与mySQL5.1安装还是有一些区别了,需要使用cmake进行安装信息的配置。据说Mysql从5.5以后安装都需要cmake。
Mysql5.6.30里面没有configure,没法通过./configure 进行安装配置,需要自己去生成配置信息
这里写图片描述

MySQL5.6.30安装

前期准备

创建mysql用户与mysql组

创建组:groupadd mysql
创建用户:useradd -r -g mysql mysql

创建mysql文件夹于数据存放文件夹data

mkdir -p /usr/local/mysql/data

安装cmake

这里写图片描述

这里写图片描述
当然也可使用yum安装命令如下
yum install cmake -y

安装信息配置

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DMYSQL_DATADIR=/usr/localhost/mysql/data
这里写图片描述

执行make && make install

这里写图片描述

进行相应的配置

1.conf:用于保存mysql配置信息
mkdir /usr/local/mysql/conf
2.var:用来存放mysql运行时文件
mkdir /usr/local/mysql/var
3.将support-files里面的my-default.cnf移到conf里面,并改名为my.cnf
这里写图片描述
4.分配权限
chown -R mysql:mysql /usr/local/mysql
这里写图片描述

初始化mysql


/usr/local/mysql/scripts/mysql_install_db--basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --skip-name-resolve--user=mysql --defaults-file=/usr/local/mysql/conf/my.cnf--pid-file=/usr/local/mysql/var/mysql.pid--socket=/usr/local/mysql/var/mysql.sock

这里写图片描述

启动与关闭mysql

启动:support-files/mysql.server start
关闭:support-files/mysql.server stop
这里写图片描述

连接mysql

这里写图片描述

mysql安装好之后的目录结构

启动之前与后比较如下图
这里写图片描述

安装可能遇到问题解决

问题1

./configure 的时候报一下的错误,可以尝试这样解决
Mysql安装:/bin/rm: cannot remove libtoolt': No such file or directory .
编译MySQL的过程中提示:
/bin/rm: cannot removelibtoolt’: No such file or directory
解决:
1、确认libtool是否已经安装,如果没有安装的话,则先安装libtool

yum -y install libtool

2、分别执行以下三条命令:

autoreconf –force –install

libtoolize –automake –force

automake –force –add-missing

再重新编译安装,问题解决!

问题二

缺少ncurses-devel包
错误信息如下
这里写图片描述
解决版本
解决方式(CentOS)
yum list"grep ncurses
yum -y install ncurses-devel
这里写图片描述

问题三

当执行mysql_install_db初始化mysql时候
发现已经存在my.cn文件,很有可能是系统之前安装了mysql没有卸载干净导致的
这里写图片描述
my.cn文件如下
这里写图片描述
这样就导致了,本地usr/local/mysql/var中没有生成mysql.sock文件
解决办法:
移除/etc/my.cn,然后重新初始化
问题四:如果启动mysql出现找不到**.pid文件问题
问题出错界面如下
这里写图片描述
修改my.cnf配置文件,指定数据库所在文件,如下
这里写图片描述
执行bin/mysqld_safe &
在执行support-files/mysql.server start

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Application practice of Python in software source code protection Application practice of Python in software source code protection Jun 29, 2023 am 11:20 AM

As a high-level programming language, Python language is easy to learn, easy to read and write, and has been widely used in the field of software development. However, due to the open source nature of Python, the source code is easily accessible to others, which brings some challenges to software source code protection. Therefore, in practical applications, we often need to take some methods to protect Python source code and ensure its security. In software source code protection, there are a variety of application practices for Python to choose from. Below are some common

How to display the source code of PHP code in the browser without being interpreted and executed? How to display the source code of PHP code in the browser without being interpreted and executed? Mar 11, 2024 am 10:54 AM

How to display the source code of PHP code in the browser without being interpreted and executed? PHP is a server-side scripting language commonly used to develop dynamic web pages. When a PHP file is requested on the server, the server interprets and executes the PHP code in it and sends the final HTML content to the browser for display. However, sometimes we want to display the source code of the PHP file directly in the browser instead of being executed. This article will introduce how to display the source code of PHP code in the browser without being interpreted and executed. In PHP, you can use

Website to view source code online Website to view source code online Jan 10, 2024 pm 03:31 PM

You can use the browser's developer tools to view the source code of the website. In the Google Chrome browser: 1. Open the Chrome browser and visit the website where you want to view the source code; 2. Right-click anywhere on the web page and select "Inspect" or press the shortcut key Ctrl + Shift + I to open the developer tools; 3. In the top menu bar of the developer tools, select the "Elements" tab; 4. Just see the HTML and CSS code of the website.

Can vue display source code? Can vue display source code? Jan 05, 2023 pm 03:17 PM

Vue can display the source code. The method for viewing the source code in Vue is: 1. Obtain Vue through "git clone https://github.com/vuejs/vue.git"; 2. Install dependencies through "npm i"; 3. Through " npm i -g rollup" to install rollup; 4. Modify the dev script; 5. Debug the source code.

A comprehensive guide to learning and applying golang framework source code A comprehensive guide to learning and applying golang framework source code Jun 01, 2024 pm 10:31 PM

By understanding the Golang framework source code, developers can master the essence of the language and expand the framework's functions. First, get the source code and become familiar with its directory structure. Second, read the code, trace the execution flow, and understand dependencies. Practical examples show how to apply this knowledge: create custom middleware and extend the routing system. Best practices include learning step-by-step, avoiding mindless copy-pasting, utilizing tools, and referring to online resources.

How to view the source code of tomcat in idea How to view the source code of tomcat in idea Jan 25, 2024 pm 02:01 PM

Steps to view tomcat source code in IDEA: 1. Download Tomcat source code; 2. Import Tomcat source code in IDEA; 3. View Tomcat source code; 4. Understand the working principle of Tomcat; 5. Precautions; 6. Continuous learning and updating ; 7. Use tools and plug-ins; 8. Participate in the community and contribute. Detailed introduction: 1. Download the Tomcat source code. You can download the source code package from the official website of Apache Tomcat. Usually these source code packages are in ZIP or TAR format, etc.

Golang framework source code analysis and optimization Golang framework source code analysis and optimization Jun 02, 2024 pm 04:54 PM

This article explores the source code analysis and optimization of the Go framework. The source code structure includes four main packages, involving core framework logic, request context, data binding and response rendering. Optimization techniques include: 1. Use routing trees to optimize route processing to significantly increase route lookup speed. 2. Use middleware for caching and compression to reduce server load and response time. 3. Avoid performing time-consuming operations in callbacks to maintain high responsiveness. 4. Enable logging and analyze slow requests to identify performance bottlenecks. 5. Update framework versions regularly to take advantage of the latest performance improvements.

PHP source code error: solving index error problem PHP source code error: solving index error problem Mar 10, 2024 am 11:12 AM

PHP source code error: To solve the index error problem, specific code examples are needed. With the rapid development of the Internet, developers often encounter various problems when writing websites and applications. Among them, PHP is a popular server-side scripting language, and its source code errors are one of the problems that developers often encounter. Sometimes, when we try to open the index page of a website, various error messages will appear, such as "InternalServerError", "Unde

See all articles