配置 MAMP 以使用 mariadb
我成功安装了 mariadb,但 MAMP 继续使用位于其 bin 文件夹中的 mysql 副本;具体来说:
/Applications/MAMP/Library/bin/mysql
如何让 MAMP 使用 mariadb,在我的例子中,它位于 /usr/local/bin/mysql 中?
我尝试在 MAMP 的 bin 文件夹中创建一个符号链接以指向 /usr/local/bin,但这不起作用。唔。
I successfully installed mariadb, but MAMP continues to use the copy of mysql located in its bin folder; specifically:
/Applications/MAMP/Library/bin/mysql
How do I get MAMP to use mariadb, which in my case is located in /usr/local/bin/mysql?
I tried creating a symbolic link in MAMP's bin folder to point to /usr/local/bin, but that didn't work. Hmm.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
MAMP 使用 MAMP/bin/startMysql.sh 启动 mysql。尝试改变它。
MAMP uses MAMP/bin/startMysql.sh to start mysql. Try to change it.
这是我的做法,这样你就可以使用 mysql 或 mariadb,因为 mariadb 是一个替代品(凭记忆输入,所以如果有错误请告诉我)...
0) 备份你的 mysql 数据库dir 以防万一,并做一些 mysql 准备以防万一
1) 复制或记下 my.cnf 文件中的一些设置。它可以位于各种不同的地方,因此要找到它们(有很多):
2)找出加载了哪个 my.cnf(对于 MAMP,它可能位于 /Applications/MAMP/conf/my.cnf 中) cnf)
3) 在 /etc/my.cnf 中备份 my.cnf 并编辑 my.cnf 以确保其中有一些参数,最重要的是端口、套接字和 datadir 设置,以便 mariadb 知道在哪里查找您的数据库文件:
4)在 [mariadb] 部分中添加您可能需要的任何 mariadb 特定配置选项
5)安装 mariadb (我喜欢使用brew,但选择您的毒药)...并且您可以随时执行此操作
6) 从第二步中的 my.conf 创建一个符号链接
6a) 你可以将 my.cnf 放在任何地方,只要 /etc/my.cnf 中有一个副本或链接...这里的目标是有玛丽亚数据库和 MAMP 的 mysql 实现使用相同的配置设置。
7) 现在创建一个 shell shell 脚本来加载 apache 和 mariadb
8) 获取/记下 apache 的当前启动/停止脚本(它可能不会有什么奇特的)
9) 获取安装的 mariadb 路径,然后 make确保它是 mariadb 版本
10) 现在编辑 startSomething.sh
11) 对 stopSomething.sh 执行相同操作
12) 就是这样! 来启动或停止操作
如果您想要普通 MAMP,请使用 MAMP 附带的 MAMP 应用程序 。否则,就可以享受这个速度稍快的数据库带来的乐趣...但请记住,虽然 mariadb 在设计上是 mysql 的替代品,但反之则不然 (MariaDB v MySQL 兼容性)
here's how i do it so that you can use either mysql or mariadb since mariadb is a drop in replacement (typing this from memory, so please let me know if there are some mistakes)...
0) make a backup of your mysql db dir just in case, and do some mysql prep just in case
1) make a copy or take note of some settings in your my.cnf file. It can be located in a variety of different places, so to find them all (there are a bunch):
2) figure out which my.cnf was loaded (for MAMP, it MAY be in /Applications/MAMP/conf/my.cnf)
3) make a backup of the my.cnf in /etc/my.cnf and edit my.cnf to make sure it's got a few parameters in there, most importantly the port, socket, and datadir settings so that mariadb will know where to look for your db files:
4) add any mariadb specific config options you may want in a [mariadb] section
5) install mariadb (i like using brew, but pick your poison)... and you can really do this any time
6) make a symbolic link from the my.conf from step two
6a) you can put your my.cnf anywhere, as long as there's a copy or link to it in /etc/my.cnf... the goal here is to have mariadb and MAMP's implementation of mysql use the same config settings.
7) now make a shell shell script to load apache and mariadb
8) get/take note of the current start/stop script for apache (it'll prob won't be anything fancy)
9) get the installed mariadb path, and make sure it's the mariadb version
10) now edit startSomething.sh
11) do the same for stopSomething.sh
12) that's it!. to start or stop things
if you want the vanilla MAMP, use the MAMP app that came with MAMP. otherwise, have fun with this slightly faster database with a bunch of fun new features... but keep in mind that while mariadb is by design a drop in replacement for mysql, it's not true the other way around (MariaDB v MySQL compatibility)