Remove mysql installation and cleanup using brew:
brew remove mysql
brew cleanup
unload homebrew.mxcl.mysql.plist if already loaded and remove it:
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
Install mysql using brew:
brew install mysql
Set up databases to run AS YOUR USER ACCOUNT with:
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
Start the mysql server:
mysql.server start
Set the root password
/usr/local/Cellar/mysql/5.5.19/bin/mysqladmin -u root password 'new-password'
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Alternatively you can run following command and follow the steps:
/usr/local/Cellar/mysql/5.5.19/bin/mysql_secure_installation
which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions.
To launch on startup:
* if this is your first install:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/mysql/5.5.19/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
* if this is an upgrade and you already have the homebrew.mxcl.mysql.plist loaded:
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
cp /usr/local/Cellar/mysql/5.5.19/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
You may also need to edit the plist to use the correct "UserName".
No comments:
Post a Comment