Execute mysql error
mysql error running under mac solve very simple, you can execute the command sudo mysql or execute a command, mysql -u root can not re-solved, I do not know, ah, you can follow easily below the unloading of heavy equipment.
ERROR 1045 (28000): Access denied for user 'zhang'@'localhost' (using password: NO)
Close running mysqld
Compare violent way:
to see whether mysql start: ps -ef | grep mysql
enter: kill -9 (./mysqld front of the second number, here is 627) then Enter
enter: ps -ef | grep mysql can continue to view process is not:
Delete mysql
Make sure before you delete are not already shut down running mysql, see above
brew remove mysql
brew cleanup
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/var/mysql
sudo rm -rf /usr/local/mysql* sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist sudo rm -rf /Library/StartupItems/MySQLCOM sudo rm -rf /Library/PreferencePanes/My* launchctl unload -w~/Library/LaunchAgents/homebrew.mxcl.mysql.plist edit /etc/hostconfig and remove the line MYSQLCOM=-YES- rm -rf ~/Library/PreferencePanes/My* sudo rm -rf /Library/Receipts/mysql* sudo rm -rf /Library/Receipts/MySQL* sudo rm -rf /private/var/db/receipts/*mysql*
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
installation
1. Perform
brew install mysql
- 1
2. After you install mysql, he will prompt you init database, and provide the following two sentences make you perform, you probably did not execute these two
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
- 1
- 2
3. Then you can point to mysql.server start to start, and for security, you can also perform security setup wizard, follow the prompts step by step configuration
mysql_secure_installation
- 1
4. Finally start
mysql.server start
- 1
Reference address
https://blog.csdn.net/xiaozh620/article/details/77530893
https://segmentfault.com/q/1010000000094608