Avant Mac
l' Mysql 8.0
heure d' installation et Mysql 5.7
il n'y a pas le même endroit, où mon propre processus d'installation est simple et enregistrez-le.
Installer l'infusion
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Installez Mysql 8.0
brew install mysql
mysql.server start
mysql_secure_installation
mysql -uroot -p
mysql> select host,user,plugin from mysql.user;
flush privileges;
Démarrer, arrêter, redémarrer
mysql.server start
mysql.server stop
mysql.server restart
changer le mot de passe
use mysql;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '新密码';
FLUSH PRIVILEGES;
Supprimer MySql
brew uninstall mysql
brew cleanup
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
sudo vim /etc/hostconfig (ps:需要删除其中的MYSQLCOM=-YES-)
sudo rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /var/db/receipts/com.mysql.*
Ajouter un compte
CREATE USER 'sampadm'@'localhost' IDENTIFIED BY 'secret';
Habiliter
GRANT ALL ON sampdb.* TO 'sampadm'@'localhost';