linux上源码安装MySQL详解_MySQL
最近需要使用MySQL Fabric,这货是MySQL5.6.10之后才出现的utility。手头机器装的是MySQL5.1,所以需要先把旧版MySQL升级成5.6版本。之前没有玩过MySQL,所以这次稍微费了点事。在此,把过程记录下来,希望能给有需求的人提供一点帮助。下面我们就正式开始。
1. 删除老版本MySQL
其实删除老版MySQL是一件很简单的事,但是开始时候由于担心各个包的依赖会导致各种问题,亦步亦趋来得很慢。其实只需要做到这么几步就可以了:1.1 查看已安装的mysql版本并删除
查看已安装的mysql版本:rpm -qa | grep -i mysql
只要将client/server两个rpm包卸载就可以,过程中可能会提示某个包的依赖,加上--nodeps即可。
1.2 删除数据文件
删除/etc/my.cnf以及安装目录/usr/local/mysql/(该目录位置是安装时指定的)下的数据文件。 rm -r /etc/my.cnf rm -rf /usr/local/mysql1.3 查看当前是否有mysql在运行
这一步经常会被忽视掉,所以需要稍微注意下。若有则kill掉。使用命令:ps -fe | grep mysql查看。经过上面的三个步骤,基本就可以把旧版mysql卸载掉了。其他遗留部分在后续安装新版mysql时,会提示有不兼容的情况,到时候再逐个删除即可。
2. 源码安装MySQL5.6
前提一:既然是源码安装,肯定要先下载一份MySQL源码了。这个大家根据自己的需求下载,在此就不赘述了。前提二:安装cmake。MySQL的编译是使用的cmake,所以需要提前安装好。这个过程也很简单,就不说了。上面的准备工作都OK之后,就开始正式安装的过程了。2.1 编译
与linux上其他的工程一样,MySQL的编译也就是make/make install。2.1.1 cmake
在代码路径下执行:cmake ./ -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DMYSQL_DATADIR=/usr/local/mysql/data \ -DSYSCONFDIR=/etc \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STO…
DMYSQL_DATADIR:MySQL的数据文件位置。
DSYSCONFDIR:MySQL的配置文件位置。
2.1.2 make && make install
这个用过linux的都知道吧。。到此,编译的过程就完成了。2.2 安装
# cd /usr/local/mysql # chown -R mysql:mysql . # chown -R mysql:mysql ./data # scripts/mysql_install_db --defaults-file=/etc/my.cnf # cp support-files/my-default.cnf /etc/my.cnf
[mysql] socket = /tmp/mysqld.sock [mysqld] user = mysql datadir = /usr/local/mysql/data port=3306
2.3 启动MySQL
有三种方法可以启动MySQL,分别如下:方法一: # bin/mysqld_safe --defaults-file=/etc/my.cnf 方法二: # bin/mysqld 方法三: cp support-files/msql.server /etc/init.d/mysql service mysql start
2.4 修改root密码
# ./bin/mysqladmin -u root password

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

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? 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

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.

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.

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.

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.

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: 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
