Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save danswater/bf157e8af7eac97df23b0c15022e05fb to your computer and use it in GitHub Desktop.
Save danswater/bf157e8af7eac97df23b0c15022e05fb to your computer and use it in GitHub Desktop.
Reset MySQL root password (Homebrew)
$> launchctl unload -w ~/Library/LaunchAgents/com.mysql.mysqld.plist
$> /usr/local/Cellar/mysql/5.5.9/bin/mysqld --basedir=/usr/local/Cellar/mysql/5.5.9 --datadir=/usr/local/Cellar/mysql/5.5.9/data --plugin-dir=/usr/local/Cellar/mysql/5.5.9/lib/plugin --log-error=/usr/local/Cellar/mysql/5.5.9/data/errors.err --pid-file=/usr/local/Cellar/mysql/5.5.9/data/pidfile.pid --skip-grant-tables
$> mysql
mysql> UPDATE mysql.user SET Password=PASSWORD('root_password') WHERE User='root';
mysql> FLUSH PRIVILEGES;
$> kill `cat /usr/local/Cellar/mysql/5.5.9/data/pidfile.pid`
$> ps auwx | grep mysql
$> launchctl load -w ~/Library/LaunchAgents/com.mysql.mysqld.plist
@danswater
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment