安装mysql
<style></style>
brew install mysql
<style></style>
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
开启安全模式
<style></style>mysqld_safe --skip-grant-tables
可以无密码登陆mysql
<style></style>mysql -uroot -p
更改mysql 密码
<style></style>update user set authentication_string='' where User='root';