Mac下Homebrew 安装 Mysql

来源:互联网 发布:软件架构设计模型 编辑:程序博客网 时间:2024/04/28 12:37

0x00 mac下mysql安装

简单记录mac下mysql安装。
这里需要一个前提——先安装 homebrew,具体可以参考这里。

0x01 安装

➜  ~ brew install mysql# 以下为删除上个版本的遗留➜  ~ cd /usr/local/var/mysql➜  mysql git:(master) lsauto.cnf           ib_buffer_pool     mysql              server-cert.pemca-key.pem         ib_logfile0        mysqld_safe.pid    server-key.pemca.pem             ib_logfile1        performance_schema sysclient-cert.pem    ibdata1            private_key.pem    ttdevs.local.errclient-key.pem     ibtmp1             public_key.pem     ttdevs.local.pid➜  mysql git:(master) rm -rf ttdevs.local.err➜  mysql git:(master) cd ~# 以上为删除上个版本的遗留

卸载: brew uninstall mysql

0x02 配置

➜  ~ /usr/local/opt/mysql/bin/mysql_secure_installationSecuring the MySQL server deployment.Connecting to MySQL using a blank password.VALIDATE PASSWORD PLUGIN can be used to test passwordsand improve security. It checks the strength of passwordand allows the users to set only those passwords which aresecure enough. Would you like to setup VALIDATE PASSWORD plugin?Press y|Y for Yes, any other key for No:Please set the password for root here.New password:Re-enter new password:By default, a MySQL installation has an anonymous user,allowing anyone to log into MySQL without having to havea user account created for them. This is intended only fortesting, and to make the installation go a bit smoother.You should remove them before moving into a productionenvironment.Remove anonymous users? (Press y|Y for Yes, any other key for No) : ySuccess.Normally, root should only be allowed to connect from'localhost'. This ensures that someone cannot guess atthe root password from the network.Disallow root login remotely? (Press y|Y for Yes, any other key for No) : ySuccess.By default, MySQL comes with a database named 'test' thatanyone can access. This is also intended only for testing,and should be removed before moving into a productionenvironment.Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y - Dropping test database...Success. - Removing privileges on test database...Success.Reloading the privilege tables will ensure that all changesmade so far will take effect immediately.Reload privilege tables now? (Press y|Y for Yes, any other key for No) : ySuccess.All done!➜  ~ mysql.server startStarting MySQL SUCCESS!

0x03 启动停止

  • brew services start/stop mysql
  • mysql.server start/stop

两种方式都可以,但是不可以交叉使用,比如用 brew services start mysql 启动 却不能用 mysql.server stop 停止。

0x04 GUI客户端

  • Sequel Pro

    免费

  • Navicat For Mysql

    收费

0x05 简单命令纪录

  • 登录:mysql -u username -p
  • 推出:exit;
  • 默认 data 目录:/usr/local/var/mysql
  • Emoji表情的支持请使用编码:utf8mb4
  • todo 2016-09-07

  1. https://segmentfault.com/q/1010000000475470
  2. http://pein0119.github.io/2015/03/25/MySQL%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%90%AF%E5%8A%A8%E9%94%99%E8%AF%AF-The-server-quit-without-updating-PID-file/
0 0
原创粉丝点击