mysql -u root -p 密码root 也能登陆,why; 使用mysqld;
macOS 10.13.1 通过 HomeBrew 安装 MySQL
$ brew remove mysql
Uninstalling /usr/local/Cellar/mysql/5.7.19... (322 files, 233MB)
Error: Permission denied @ unlink_internal - /usr/local/lib/libmysqlclient.20.dylib
// 笨方法,进入相应目录,删除软连接
$ sudo unlink libmysqlclient.20.dylib
==> Installing mysql
==> Downloading https://homebrew.bintray.com/bottles/mysql-5.7.20.high_sierra.bo
######################################################################## 100.0%
==> Pouring mysql-5.7.20.high_sierra.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink lib/libmysqlclient.20.dylib
/usr/local/lib is not writable.
You can try again using:
brew link mysql
==> /usr/local/Cellar/mysql/5.7.20/bin/mysqld --initialize-insecure --user=kokia
==> Caveats
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
==> Summary
🍺 /usr/local/Cellar/mysql/5.7.20: 324 files, 233.7MB
macOS High Sierra 10.13.1, /usr/local 无法添加所有权;
$ sudo chown -R $(whoami) /usr/local
Password:
chown: /usr/local: Operation not permitted
kokiadeMacBook-Pro:~ kokia$ sudo chown -R $(whoami) /usr/local/lib
主要参考这篇文章
Mac Pro下卸载安装Mysql
$ brew remove mysql
$ rm -rf /usr/local/var/mysql/
$ brew install mysql
==> Downloading https://homebrew.bintray.com/bottles/mysql-5.7.20.high_sierra.bo
Already downloaded: /Users/kokia/Library/Caches/Homebrew/mysql-5.7.20.high_sierra.bottle.tar.gz
==> Pouring mysql-5.7.20.high_sierra.bottle.tar.gz
==> /usr/local/Cellar/mysql/5.7.20/bin/mysqld --initialize-insecure --user=kokia
==> Caveats
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
==> Summary
🍺 /usr/local/Cellar/mysql/5.7.20: 324 files, 233.7MB
安装时默认密码为root
$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.19 Homebrew
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
网友评论