1. Download and install Download the community edition dmg installation file from the official website: https://dev.mysql.com/downloads/mysql/ 1. Execute the installation file and follow the steps to complete the installation. 2. After the installation is complete, enter the following in the terminal: mysql --version; ----If the version number is displayed, it is normal. If it displays command not found, enter the following in the terminal. "/usr/local/mysql/bin/mysql" is the default installation path of MySQL: $ cd /usr/local/bin/ $ sudo ln -fs /usr/local/mysql/bin/mysql mysql 3. Shut down the mysql service: sudo /usr/local/mysql/support-files/mysql.server stop 2. Environment variable configuration 1. Open the terminal and enter: cd ~ Will enter the ~ folder 2. Then enter: touch .bash_profile After pressing Enter, 3. Then input: open -e .bash_profile This file will open in TextEdit (if you have not configured environment variables before, this should be a blank document). If there is content, please enter it before the end character. If there is no content, please enter the following statement directly: export PATH=${PATH}:/usr/local/mysql/bin Then, save, exit TextEdit (be sure to exit), close the terminal and exit. 3. Forgot root password reset 1. Apple->System Preferences->Stop MySQL service (click stop MySQL server) 2. Enter the terminal and input: cd /usr/local/mysql/bin/ After pressing Enter, log in as administrator sudo su After pressing Enter, enter the following command to disable the MySQL authentication function ./mysqld_safe --skip-grant-tables & After pressing Enter, MySQL will automatically restart (the status of MySQL in the preferences will become running) 3. Enter the command ./mysql After pressing Enter, enter the command FLUSH PRIVILEGES; After pressing Enter, enter the command SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123'); The modification is now complete. After restarting the terminal, enter mysql -u root -p, press Enter, and then enter the password: 123 to start successfully. 4. Delete Stop the MySql process and enter the following command in the console. sudo rm /usr/local/mysql sudo rm -rf /usr/local/mysql* sudo rm -rf /Library/StartupItems/MySQLCOM sudo rm -rf /Library/PreferencePanes/My* vim /etc/hostconfig (and removed the line MYSQLCOM=-YES-) 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.* The above is the detailed installation and configuration of MySql on Mac introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: Vue simple implementation of turntable lottery
>>: Solve the problem of regular automatic file deletion by crontab+shell script under Centos7
Table of contents Preface VMware clone virtual ma...
Table of contents Preface 1. Download a single fi...
This article shares the MySQL Workbench installat...
1. readonly read-only attribute, so you can get th...
1. The significance of building nexus service As ...
The SSH mentioned here is called Security Shell. ...
need: The backend returns an array object, which ...
Table of contents 1. Developer Platform Configura...
1. CPU utilization sar -p (view all day) sar -u 1...
Table of contents Impact of full table scan on th...
HTML5 adds a native placeholder attribute for inp...
Table of contents background Achieve a similar ef...
Technology Fan html web page, you must know vue f...
Six steps of JDBC: 1. Register the driver 2. Get ...
Table of contents 1. Create a stored function 2. ...