MySql installation configuration on Mac and MySqlMac installation Configuration
1. Download and install
Download Community version dmg installation files: https://dev.mysql.com/downloads/mysql/
1. Execute the installation file and follow the steps to complete the installation.
2. Enter the following terminal information after installation:
mysql --version;
---- If command not found is displayed, enter "/usr/local/mysql/bin/mysql" as the default mysql installation path:
$ cd /usr/local/bin/$ sudo ln -fs /usr/local/mysql/bin/mysql mysql
3. Close the mysql service:
sudo /usr/local/mysql/support-files/mysql.server stop
II. Environment Variable Configuration
1. Open the terminal and enter:
cd ~
Will enter ~ Folder
2. Enter:
touch .bash_profile
After you press enter to execute,
3. Enter:
open -e .bash_profile
This file will be opened in TextEdit (if environment variables have not been configured before, this should be a blank document ). If there is content, enter it before the Terminator. If there is no content, enter the following statement:
Export PATH =$ {PATH}:/usr/local/mysql/bin
Then, save and exit TextEdit (it must be quit), close the terminal, and exit.
3. Reset the root password
1. Apple-> system preference settings-> close mysql Service (Click stop mysql server)
2. Enter the terminal:
cd /usr/local/mysql/bin/
Enter and log on to the Administrator
sudo su
Press enter and enter the following command to disable mysql verification.
./mysqld_safe --skip-grant-tables &
After you press enter, mysql will automatically restart (mysql in preference settings will change to running)
3. Enter the command
./mysql
Press enter and enter the command
FLUSH PRIVILEGES;
Press enter and enter the command
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123');
Now the modification is complete. After the terminal is restarted, enter mysql-u root-p and press enter, and then enter the password: 123 to start successfully.
Iv. Delete
Stop the MySql process and run the following command on the console.
1、sudo rm /usr/local/mysql2、sudo rm -rf /usr/local/mysql*3、sudo rm -rf /Library/StartupItems/MySQLCOM4、sudo rm -rf /Library/PreferencePanes/My*5、vim /etc/hostconfig (and removed the line MYSQLCOM=-YES-)6、rm -rf ~/Library/PreferencePanes/My*7、sudo rm -rf /Library/Receipts/mysql*8、sudo rm -rf /Library/Receipts/MySQL*9、sudo rm -rf /var/db/receipts/com.mysql.*