mysql - OSX 10.11.1 安装5.7.9 命令登陆提示需要密码
PHP中文网
PHP中文网 2017-04-17 13:33:16
0
4
412

安装好了mysql 命令连接和navicate 都提示需要密码登录。按照着这里的做法 可还是不行。

brew install mysql
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp

下面是提示。还是不行

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(4)
PHPzhong

迷茫

I also encountered this problem this morning and struggled with it for a long time. You can refer to the following methods:

  1. Stop the MySQL service mysql.server stop

  2. Back up the /usr/local/var/mysql/ folder, and then delete everything in the folder

  3. Execute the mysqld --initialize command, and a temporary password will be generated, similar to A temporary password is generated for root@localhost: k+njnwJML78a

  4. Restart the MySQL service mysql.server start. If unsuccessful, you can shut down and restart, and then restart the MySQL service

  5. You should be able to log in with this password now

阿神

Thank you very much for the inspiration provided by @Charlesshen’s answer. After mysql version 5.7, the initial password of root is no longer empty/root, etc. It has become a random temporary password. During installation, online tutorials all prompt It said it would pop up, but I didn't see it, so I carefully looked at the installation method of the tar package and found that this installation is feasible. Then the second step folder of @Charlesshen above should be /usr/local/mysql/ data, directly sudo rm -rf ./data. Then continue to execute and a temporary password will appear.

巴扎黑

I switched to Mariadb because of this problem

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template