MySql 便携版

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1851174/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 14:41:33  来源:igfitidea点击:

MySql portable version

mysqlportability

提问by Leo

anyone know a portable version of mysql?

有人知道mysql的便携版本吗?

I know xampp but it comes with PHP and Apache together

我知道 xampp 但它与 PHP 和 Apache 一起提供

anyone know how to isolate the mysql?

有人知道如何隔离mysql吗?

回答by Synetech

You can download the MySQL Essentials version and make a few small changes to directories in the my.inifile to use relative paths instead of absolute paths. Then you can run the server directly without having to install or use a Windows service.

您可以下载 MySQL Essentials 版本并对my.ini文件中的目录进行一些小的更改以使用相对路径而不是绝对路径。然后您可以直接运行服务器,而无需安装或使用 Windows 服务。

  1. Download a MySQL .zipfile (instead of an .msi, though you could get the .msiand use 7Zip or Orca to extract the files from it).

  2. Extract the files. At a minimum you need the binand sharedirectories (actually, in bin, you really only need mysqld.exeas the absolute minimum to run a server).

  3. Edit my.inito change the basedirand datadirpaths to something relative. For example:

    basedir=".."
    datadir="/MySQLdb"
    
  4. If you do not have an existing database, then create one:

    mysqld --bootstrap
    
  5. Run the server (you may need to use the --skip-grant-tablesswitch to get it running until you have set up your MySQL user):

    mysqld
    
    • To avoid the server being run in the current command-prompt, you can use the following to have it run in its own console which should disappear once it is running:

      start mysqld
      
    • If you get errors, delete the log files (e.g., logs\ib_logfile*) and run it again.

  1. 下载一个MySQL.zip文件(而不是一个.msi,但你可以得到.msi和使用7Zip的逆戟鲸,以从中提取的文件)。

  2. 提取文件。您至少需要binshare目录(实际上,在 中bin,您实际上只需要mysqld.exe作为运行服务器的绝对最小值)。

  3. 编辑my.ini以将basedirdatadir路径更改为相关内容。例如:

    basedir=".."
    datadir="/MySQLdb"
    
  4. 如果您没有现有数据库,请创建一个:

    mysqld --bootstrap
    
  5. 运行服务器(--skip-grant-tables在设置 MySQL 用户之前,您可能需要使用开关使其运行):

    mysqld
    
    • 为避免服务器在当前命令提示符下运行,您可以使用以下命令让它在自己的控制台中运行,一旦运行,该控制台就会消失:

      start mysqld
      
    • 如果出现错误,请删除日志文件(例如logs\ib_logfile*)并再次运行。

回答by yoda

I think not, without counting on XAMPP. You don't have to use PHP or Apache anyway, just run the mysql from the .exe's

我认为不会,不指望 XAMPP。无论如何,您不必使用 PHP 或 Apache,只需从 .exe 运行 mysql