Mysql notes to myself[WIP]

By Oguzhan Cakmak at

Mysql commands

Upgrade

mysql_upgrade
mysql_upgrade --protocol=tcp -P 3306 --user=root --host=127.0.0.1 --skip-version-check --force -uroot -p

Install current mysql version

brew install mysql

Start agent for current version of mysql (including on login)

ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

Install the different version of mysql

Find older mysql versions

brew search mysql

Install older mysql version

brew install homebrew/versions/[email protected]

Start agent for older version of mysql (including on login)

ln -sfv /usr/local/opt/[email protected]./*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/[email protected]

Dump mysql

mysqldump --all-databases -uroot > dump.sql

Use dump db

mysql -u username -p -h localhost DATA-BASE-NAME < data.sql
mysql -u root -p
create database mydb;
use mydb;
source db_backup.dump;

Uninstall MySql on a Mac OS X

Uninstall Mysql MacOS

Stopping Background Services with Homebrew