Linux下MySQL多实例免安装部署
在LAMP平台和LNMP平台上,数据的存储主要是存储在MySql数据库上。MySql从3.23.15版本开始,提供了主从同步复制机制,通过复制机制
目前,LAMP、LNMP是两套非常流行的开源Linux Web服务搭建方式。以免费高效著称,是很多网站和Web系统的首选服务器架构。
业务数据往往是很宝贵的资源,业务数据的损坏和丢失,对企业来讲是一个重大损失。因此,对业务数据做实时的备份和恢复显得尤为重要。
在LAMP平台和LNMP平台上,数据的存储主要是存储在MySql数据库上。MySql从3.23.15版本开始,提供了主从同步复制机制,通过复制机制,可以达到数据实时备份的目的。同时,还可以使用该技术,进行数据读写分离,提高效率。因此,在常规情况下,一般是一台Web,3台DB。
可能你有充足的资金预算,,可以购买3台DB服务器来满足业务需要,也可能资金预算不足,只能买两台DB服务器甚至一台DB服务器。那么,必然会有一台服务器运行至少两个数据库示例。
本文重点讲述如何在一台Linux服务器上快速部署多个MySql数据库实例。软件情况如下:
1.操作系统:RedHat Linux 5.4 Enterprise
2.MySql版本:MySql-5.1.44
下面开始吧。
1.获得MySql编译好的二进制程序文件及相关配置文件
获得编译好的二进制程序文件有三种方式,第一种是直接在MySql的官方网站下载编译好的二进制版本,第二种是在已经安装好MySql数据库的服务器上提取,第三种,就是下载源代码包自己编译,得到编译后的二进制版本。
本文采用的是第二种方式,从已经安装好的MySql服务器上提取编译过的MySql文件(安装采用的是源代码本机编译形式安装)。
提取方法:
1.1登录MySql服务器,获取MySql安装路径。可以在mysql控制台下,使用如下指令获取到安装路径:
show variables like '%basedir%';
查询结果如下:
从上图可以看出,我们的MySql是安装在/usr/local/mysql/目录下的。得到了mysql的安装路径,就可以开始MySql文件的提取操作了。
1.2登录到安装mysql的linux服务器上,进入mysql的安装目录。我们需要进入的目录是:/usr/local/。
使用指令如下:
cd /usr/local
操作结果如下:
可以使用pwd指令,查看当前所在的目录位置。操作指令如下:
pwd
操作结果如下:
可以看出,我们当前是在/usr/local目录。现在我们看看目录下的文件夹及文件情况。使用指令如下(两个小写的L字母):
ll
操作结果如下:
在上图的操作文件及文件夹列表中,我们看到了mysql目录,这个就是mysql的安装目录。
1.3提取mysql安装文件
找到了MySql,下一步就是将这个mysql文件夹及下面所有的子文件夹和文件全部打包。打包我们使用linux系统自带的tar指令。指令如下:
tar -zcf /root/mysql-noinstall-5.1.44.tar.gz mysql
指令格式:tar 参数 打包后的文件存储路径 要打包的目录或文件的路径
操作结果如下:
在这里,因为没有在参数上加v参数,所以没有列出打包文件的详细步骤,不过文件的确已经打包好并且放到/root下了。可以进入/root目录去看看。指令如下:
cd #
ll
操作结果如下:
可以看到,mysql-noinstall-5.1.44.tar.gz文件已经创建好了。下一步就是将文件传输到要安装mysql的服务器上了。传输方式很多,选一种自己习惯的方式,只要文件被拷贝过去就行了。

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











Full table scanning may be faster in MySQL than using indexes. Specific cases include: 1) the data volume is small; 2) when the query returns a large amount of data; 3) when the index column is not highly selective; 4) when the complex query. By analyzing query plans, optimizing indexes, avoiding over-index and regularly maintaining tables, you can make the best choices in practical applications.

Yes, MySQL can be installed on Windows 7, and although Microsoft has stopped supporting Windows 7, MySQL is still compatible with it. However, the following points should be noted during the installation process: Download the MySQL installer for Windows. Select the appropriate version of MySQL (community or enterprise). Select the appropriate installation directory and character set during the installation process. Set the root user password and keep it properly. Connect to the database for testing. Note the compatibility and security issues on Windows 7, and it is recommended to upgrade to a supported operating system.

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

MySQL and MariaDB can coexist, but need to be configured with caution. The key is to allocate different port numbers and data directories to each database, and adjust parameters such as memory allocation and cache size. Connection pooling, application configuration, and version differences also need to be considered and need to be carefully tested and planned to avoid pitfalls. Running two databases simultaneously can cause performance problems in situations where resources are limited.

Data Integration Simplification: AmazonRDSMySQL and Redshift's zero ETL integration Efficient data integration is at the heart of a data-driven organization. Traditional ETL (extract, convert, load) processes are complex and time-consuming, especially when integrating databases (such as AmazonRDSMySQL) with data warehouses (such as Redshift). However, AWS provides zero ETL integration solutions that have completely changed this situation, providing a simplified, near-real-time solution for data migration from RDSMySQL to Redshift. This article will dive into RDSMySQL zero ETL integration with Redshift, explaining how it works and the advantages it brings to data engineers and developers.

In MySQL database, the relationship between the user and the database is defined by permissions and tables. The user has a username and password to access the database. Permissions are granted through the GRANT command, while the table is created by the CREATE TABLE command. To establish a relationship between a user and a database, you need to create a database, create a user, and then grant permissions.

LaravelEloquent Model Retrieval: Easily obtaining database data EloquentORM provides a concise and easy-to-understand way to operate the database. This article will introduce various Eloquent model search techniques in detail to help you obtain data from the database efficiently. 1. Get all records. Use the all() method to get all records in the database table: useApp\Models\Post;$posts=Post::all(); This will return a collection. You can access data using foreach loop or other collection methods: foreach($postsas$post){echo$post->

MySQL is suitable for beginners because it is simple to install, powerful and easy to manage data. 1. Simple installation and configuration, suitable for a variety of operating systems. 2. Support basic operations such as creating databases and tables, inserting, querying, updating and deleting data. 3. Provide advanced functions such as JOIN operations and subqueries. 4. Performance can be improved through indexing, query optimization and table partitioning. 5. Support backup, recovery and security measures to ensure data security and consistency.
