Using HomeBrew to install MySQL

百般思念 提交于 2020-05-28 08:15:48

问题


I have MySQL stable 8.0.19 (bottled) installed via mac HomeBrew:

brew install mysql

and it asks me to follow these instructions in the Caveat section:

We've installed your MySQL database without a root password. To secure it run:
    mysql_secure_installation

MySQL is configured to only allow connections from localhost by default

To connect run:
    mysql -uroot

To have launchd start mysql now and restart at login:
  brew services start mysql
Or, if you don't want/need a background service you can just run:
  mysql.server start

and when I run the mysql_secure_installation command with or without sudo I get:

Securing the MySQL server deployment.

Enter password for user root: 

Now I tried looking for the default password. The MySQL installation process for macOS here shows that on the last step a temporary password is provided for the user:

   

However, I do not see any information about a temporary password within the HomeBrew terminal outputs. From here I tried:

sudo grep 'temporary password' /var/log/mysqld.log

but I get:

grep: /var/log/mysqld.log: No such file or directory

then I tried looking for that log file:

sudo find / -name mysqld.log

but I get lots of find: ... Operation not permitted instead of any meaningfull results.

I would appreciate if you could help me know

  • if I have done everything correctly so far,

    • if not what mistakes I have made and how to fix them
  • if yes how I can acquire the temporary password

  • what are the next steps

Ideally, I should be able to follow the rest of this tutorial within the GUI.


回答1:


Ok, I think I had some progress. I ran

brew services list

and it showed that mysql stopped, now I ran:

brew services start mysql

now the mysql_secure_installation script ran smoothly with

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

helping me set up a password and other settings. Now you may install the MySQL Workbench (the GUI seen in the tutorial) by:

brew cask install mysqlworkbench

and you should be able to find and run MYSQLWorkbench from your /Applications/ folder!

P.S. Wrote simple instructions here.




回答2:


For macOS users, there is DBngin (https://dbngin.com) that gives you push-button start/stop for MySql, PostgreSQL (and redis) .. different versions with non-overlapping config/data directories. Really saves me - and my students! - in my DB course.



来源:https://stackoverflow.com/questions/60864461/using-homebrew-to-install-mysql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!