简体   繁体   English

使用Macports设置MySQL 5.6

[英]Setup MySQL 5.6 with Macports

MacOS 10.10, up-to-date macports. MacOS 10.10,最新的macports。 I want to get mysql 5.6 on port 3306. 我想在端口3306上获取mysql 5.6。

1) Installing 1) 安装

port install mysql56-server mysql56

installs mysql56@5.6.22_0, after that 之后安装mysql56@5.6.22_0

which mysql

or 要么

which mysql56

returns nothing. 没有回报。

So first question is where is mysql client? 所以第一个问题是mysql客户端在哪里?

2) Configuring 2) 配置

Installation script suggests to do 安装脚本建议这样做

sudo -u _mysql /opt/local/lib/mysql56/bin/mysql_install_db

then 然后

/opt/local/lib/mysql56/bin/mysqladmin -u root password 'new-password'

which asks for running server and I start it by 要求运行服务器,我启动它

cd /opt/local ; /opt/local/lib/mysql56/bin/mysqld_safe &

then mysqladmin complains about socket and I comment --skip-networking in /opt/local/etc/mysql56/macports-default.cnf and after that command goes ok. 然后mysqladmin抱怨socket,我在/opt/local/etc/mysql56/macports-default.cnf中评论--skip-networking然后命令就行了。 then 然后

/opt/local/lib/mysql56/bin/mysqladmin -u root -h bp.local password 'new-password'

which returns 返回

error: 'Host '10.0.1.9' is not allowed to connect to this MySQL server'

I really don't know what to do here without mysql client. 没有mysql客户端,我真的不知道该怎么做。 And I'm kind of stuck. 而且我有点卡住了。 Any suggestions? 有什么建议?

MacPorts installs MySQL and its derivatives in a way that they don't conflict with each other and can be installed at the same time. MacPorts以不会相互冲突的方式安装MySQL及其衍生产品,并且可以同时安装。 That includes putting the mysql binary in non-standard paths. 这包括将mysql二进制文件放在非标准路径中。 You can locate your binary using port contents mysql56 | grep -E '/s?bin/' 您可以使用port contents mysql56 | grep -E '/s?bin/'找到二进制文件 port contents mysql56 | grep -E '/s?bin/' . port contents mysql56 | grep -E '/s?bin/' MacPorts also comes with a selection mechanism that creates symlinks for your convenience in /opt/local/bin . MacPorts还附带了一个选择机制,可以在/opt/local/bin为方便起见创建符号链接。 To make MySQL 5.6 your default, run sudo port select --set mysql mysql56 . 要使MySQL 5.6成为默认值,请运行sudo port select --set mysql mysql56

To start the server, you can use MacPorts' daemon control functions (that are a frontend to launchd): sudo port load mysql56-server will start the server and ensure it is running after a reboot, sudo port unload mysql56-server will undo that and stop the server. 要启动服务器,你可以使用MacPorts的守护进程控制功能(这是一个前端启动): sudo port load mysql56-server将启动服务器并确保它在重启后运行, sudo port unload mysql56-server将撤消并停止服务器。

The --skip-networking is the default to make running multiple MySQL versions side-by-side possible. --skip-networking是默认使并行运行多个MySQL版本的默认设置。 See port notes mysql56 for more information. 有关更多信息,请参阅port notes mysql56

You can connect to MacPorts' MySQL using a unix socket, although I don't recall its path from the top of my head. 您可以使用unix套接字连接到MacPorts的MySQL,但我不记得它的顶部路径。 I'm sure http://trac.macports.org/wiki/howto/MAMP has them, though. 不过我确信http://trac.macports.org/wiki/howto/MAMP有它们。 To connect to your local server, you should use localhost or 127.0.0.1 instead of bp.local , which apparently resolves to a private IP address and thus goes through the IP stack of your OS, rather than through the loopback interface. 要连接到本地服务器,您应该使用localhost127.0.0.1而不是bp.local ,它显然解析为专用IP地址,因此通过操作系统的IP堆栈,而不是通过环回接口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM