search
HomeDatabaseMysql Tutorial在一台机器上,怎样开启两个mysql服务

原贴:http://www.wangwa.com/info/2007-04/68630.htm 在一台机器上,怎样开启两个mysql服务 [日期: 2007-04-12 ] 来源: 作者: [字体:大 中 小] 在一台机器上,怎样开启两个mysql服务 悬赏分:20 - 解决时间:2006-9-24 18:36 在一台机器上运行两个mysql

原贴:http://www.wangwa.com/info/2007-04/68630.htm

在一台机器上,怎样开启两个mysql服务

[日期:2007-04-12] 来源:  作者: [字体:大 中 小]

在一台机器上,怎样开启两个mysql服务


在一台机器上,怎样开启两个mysql服务 悬赏分:20 - 解决时间:2006-9-24 18:36

在一台机器上运行两个mysql服务,对应两个数据库,应该怎样操作?

在一台机器上,怎样开启两个mysql服务最佳答案

7月26日 10:36 有些情况下你可能想要在同一台机器上运行多个服务器。例如,你可能想要测试一个新的MySQL版本而让你现有生产系统的设置不受到干扰,或你可能是想要为不同的客户提供独立的MySQL安装一个因特网服务供应商。

如果你想要运行多个服务器,最容易的方法是用不同的TCP/IP端口和套接字文件重新编译服务器,因此他们不是侦听同一个TCP/IP端口或套接字。

假设一个现存服务器配置为缺省端口号和套接字文件,那么用一个这样的configure命令行设置新的服务器:

shell> ./configure --with-tcp-port=port_number /
--with-unix-socket=file_name /
--prefix=/usr/local/mysql-3.22.9

这里port_number和file_name应该不同于缺省端口号和套接字文件路径名,而且--prefix值应该指定一个不同于现存的MySQL安装所在的安装目录。

你可以用这个命令检查由任何当前执行的MySQL所使用的套接字和端口:

shell> mysqladmin -h hostname --port=port_number variables

如果你有一个MySQL服务器正运行在你使用了的端口上,你将得到MySQL的一些最重要的可配置变量的一张表,包括套接字名等。

你也应该编辑你机器的初始化脚本(可能是“mysql.server”)来启动并杀死多个mysqld服务器。

你不必重新编译一个新MySQL服务器,只要以一个不同的端口和套接字启动即可。你可以通过指定在运行时safe_mysqld使用的选项来改变端口和套接字:

shell> /path/to/safe_mysqld --socket=file_name --port=port_number

如果你在与开启日志的另一个服务器相同的一个数据库目录下运行新服务器,你也应该用safe_mysqld的--log和--log-update选项来指定日志文件的名字,否则,两个服务器可能正在试图写入同一个日志文件。

警告:通常你决不应该有在同一个数据库中更新数据的2个服务器!如果你的OS不支持无故障(fault-free)的系统锁定,这可能导致令人惊讶的事情发生!

如果你想要为第二个服务器使用另一个数据库目录,你可以使用safe_mysqld的--datadir=path选项。

Statement
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
What Are the Limitations of Using Views in MySQL?What Are the Limitations of Using Views in MySQL?May 14, 2025 am 12:10 AM

MySQLviewshavelimitations:1)Theydon'tsupportallSQLoperations,restrictingdatamanipulationthroughviewswithjoinsorsubqueries.2)Theycanimpactperformance,especiallywithcomplexqueriesorlargedatasets.3)Viewsdon'tstoredata,potentiallyleadingtooutdatedinforma

Securing Your MySQL Database: Adding Users and Granting PrivilegesSecuring Your MySQL Database: Adding Users and Granting PrivilegesMay 14, 2025 am 12:09 AM

ProperusermanagementinMySQLiscrucialforenhancingsecurityandensuringefficientdatabaseoperation.1)UseCREATEUSERtoaddusers,specifyingconnectionsourcewith@'localhost'or@'%'.2)GrantspecificprivilegeswithGRANT,usingleastprivilegeprincipletominimizerisks.3)

What Factors Influence the Number of Triggers I Can Use in MySQL?What Factors Influence the Number of Triggers I Can Use in MySQL?May 14, 2025 am 12:08 AM

MySQLdoesn'timposeahardlimitontriggers,butpracticalfactorsdeterminetheireffectiveuse:1)Serverconfigurationimpactstriggermanagement;2)Complextriggersincreasesystemload;3)Largertablesslowtriggerperformance;4)Highconcurrencycancausetriggercontention;5)M

MySQL: Is it safe to store BLOB?MySQL: Is it safe to store BLOB?May 14, 2025 am 12:07 AM

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

MySQL: Adding a user through a PHP web interfaceMySQL: Adding a user through a PHP web interfaceMay 14, 2025 am 12:04 AM

Adding MySQL users through the PHP web interface can use MySQLi extensions. The steps are as follows: 1. Connect to the MySQL database and use the MySQLi extension. 2. Create a user, use the CREATEUSER statement, and use the PASSWORD() function to encrypt the password. 3. Prevent SQL injection and use the mysqli_real_escape_string() function to process user input. 4. Assign permissions to new users and use the GRANT statement.

MySQL: BLOB and other no-sql storage, what are the differences?MySQL: BLOB and other no-sql storage, what are the differences?May 13, 2025 am 12:14 AM

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

MySQL Add User: Syntax, Options, and Security Best PracticesMySQL Add User: Syntax, Options, and Security Best PracticesMay 13, 2025 am 12:12 AM

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

MySQL: How to avoid String Data Types common mistakes?MySQL: How to avoid String Data Types common mistakes?May 13, 2025 am 12:09 AM

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters

See all articles

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 Article

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use