Home Database Mysql Tutorial Linux下编译安装第二个MySQL

Linux下编译安装第二个MySQL

Jun 07, 2016 pm 04:54 PM
mysql o database

Linux的作业要自己编译一个MySQL,但是我的系统上已经有一个MySQL了,再编译一个,最麻烦的地方不在于编译,而是让两个共存。

Linux的作业要自己编译一个MySQL,但是我的系统上已经有一个MySQL了,再编译一个,最麻烦的地方不在于编译,而是让两个共存。

前面的编译环节和普通安装没有什么区别,还是configure,make,make install。其中configure的时候,选择一下安装的位置,否则可能导致原来的文件被覆盖(使用--prefix选项)。我的破电脑make的时候花了不少时候(具体多少我也不清楚,开始编译之后就去吃饭了),安装好之后,按照MySQL的手册复制support-files/my-medium.cnf到安装目录里面的var目录下(没有安装数据库的时候这个文件夹不存在,自己在安装根目录下创建一个),然后修改里面的客户端通信使用的socket文件的名字sed -i -e 's/MySQL.sock/MySQL1.sock/' /opt/MySQL/var/my.cnf,这里把socket文件改成了MySQL1.sock(原来的MySQL默认的socket文件是MySQL.sock,不修改会导致两个socket文件冲突)。如果要同时通过网络监听,可能还需要修改里面的监听端口,反正我只是当成作业演示一下,所以监听端口就没有修改。

后面的操作和手册上一样,,偷懒了下,没有导出环境变量,所以要输入绝对路径。先改变了文件夹的拥有者,然后就用MySQL_install_db --user=MySQL创建了数据库(这里要防止使用原来PATH下的MySQL程序)。最后启动MySQL,MySQLd_safe --user=MySQL &(还是一样,注意不要用原来MySQL的程序)。

这时,新的MySQL已经启动,可以用MySQL命令连接了(好像这里还是要用新的那个),创建了个数据库,测试了一下一切ok,没有对以前的MySQL有影响。

关键点就是MySQL的配置文件my.cnf文件要复制到MySQL安装目录的var文件夹下(MySQL用来保存数据库文件的文件夹),这样这个配置文件只对该服务器有效,不会影响到系统中默认的/etc下的那个配置文件。为了防止两个MySQLd的监听冲突,最好修改配置文件里面的socket和监听端口(如果通过网络连接)。

在Ubuntu上配置出现问题了。ubuntu好像不会用新的配置文件替换全局配置文件(MySQL读取配置文件顺序是/etc/my.cnf->数据库安装目录/my.cnf->个人主目录/.my.cnf)所以在创建数据库(使用MySQL_install_db)时,仍然需要指定my.cnf文件路径(使用--defaults-file选项)。在启动数据库时也同样需要。使用MySQL命令连接数据库时,也需要指定连接的socket文件,或者my.cnf文件。

如果在安装数据库时出现unknown option '--skip-federated',直接把自己的那份my.cnf文件里的skip-federated行注释。

linux

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

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)

How to fix mysql_native_password not loaded errors on MySQL 8.4 How to fix mysql_native_password not loaded errors on MySQL 8.4 Dec 09, 2024 am 11:42 AM

One of the major changes introduced in MySQL 8.4 (the latest LTS release as of 2024) is that the "MySQL Native Password" plugin is no longer enabled by default. Further, MySQL 9.0 removes this plugin completely. This change affects PHP and other app

How to install and register the btc trading app? How to install and register the btc trading app? Feb 21, 2025 pm 07:09 PM

This article will provide a detailed introduction to how to install and register a Bitcoin trading application. The Bitcoin trading app allows users to manage and trade cryptocurrencies such as Bitcoin. The article guides users through the installation and registration process step by step, including downloading applications, creating accounts, performing identity verification, and first deposit. The goal of the article is to provide beginners with clear and easy-to-understand guidelines to help them easily enter the world of Bitcoin trading.

Ouyi Exchange Download Official Portal Ouyi Exchange Download Official Portal Feb 21, 2025 pm 07:51 PM

Ouyi, also known as OKX, is a world-leading cryptocurrency trading platform. The article provides a download portal for Ouyi's official installation package, which facilitates users to install Ouyi client on different devices. This installation package supports Windows, Mac, Android and iOS systems. Users can choose the corresponding version to download according to their device type. After the installation is completed, users can register or log in to the Ouyi account, start trading cryptocurrencies and enjoy other services provided by the platform.

Top 10 global digital currency trading apps recommended (2025 currency trading software ranking) Top 10 global digital currency trading apps recommended (2025 currency trading software ranking) Mar 12, 2025 pm 05:48 PM

This article recommends the top ten digital currency trading apps in the world, including Binance, OKX, Huobi Global, Coinbase, Kraken, Gate.io, KuCoin, Bitfinex, Gemini and Bitstamp. These platforms have their own characteristics in terms of transaction pair quantity, transaction speed, security, compliance, user experience, etc. For example, Binance is known for its high transaction speed and extensive services, while Coinbase is more suitable for novices. Choosing a platform that suits you requires comprehensive consideration of your own needs and risk tolerance. Learn about the world's mainstream digital currency trading platforms to help you conduct digital asset trading safely and efficiently.

Which digital currency app trading software is the best? Digital currency trading software big spot Which digital currency app trading software is the best? Digital currency trading software big spot Mar 07, 2025 pm 06:45 PM

There is no single "best" digital currency trading app, and the choice depends on personal needs. 1. OKX has powerful functions and rich currency types; 2. Binance has high liquidity and diverse transaction types; 3. Gate.io provides unique functions such as staking mining; 4. Huobi Global has a friendly interface and multi-language support; 5. Kraken focuses on security; 6. Coinbase is suitable for beginners and focuses on user education. When choosing, you need to consider security, liquidity, handling fees, functions, user experience and other factors.

The page is blank after PHP is connected to MySQL. What is the reason for the invalid die() function? The page is blank after PHP is connected to MySQL. What is the reason for the invalid die() function? Apr 01, 2025 pm 03:03 PM

The page is blank after PHP connects to MySQL, and the reason why die() function fails. When learning the connection between PHP and MySQL database, you often encounter some confusing things...

Top 10 virtual digital currency trading platforms 2025 rankings, top ten virtual currency app exchanges Top 10 virtual digital currency trading platforms 2025 rankings, top ten virtual currency app exchanges Feb 21, 2025 pm 09:03 PM

This article introduces 10 mainstream cryptocurrency exchanges, covering basic information such as their establishment time, service scope, security, liquidity, transaction fees, etc. These exchanges include: OKX, Binance, Gate.io, Bitget, Coinbase, Huobi, KuCoin, Crypto.com, Gemini and Kraken.

Digital currency trading platform 2025 Digital currency trading platform 2025 Mar 04, 2025 pm 07:06 PM

Based on global information, this article compiles the rankings of the world's leading virtual digital currency trading platforms, including Binance, OKX, Gate.io, Huobi, Coinbase, Kraken, Crypto.com, bitget, KuCoin and Bitstamp. These platforms have their own characteristics in terms of user count, transaction volume, transaction types, security, compliance, etc. For example, Binance is known for its large user base and extensive trading options, while Coinbase is known for its leadership and ease of use in the US market. Choosing a suitable trading platform requires weighing factors such as security, fees, and trading products based on your own needs.

See all articles