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
The sort command is very commonly used, but it al...
This article example shares the specific code of ...
tomcat is an open source web server. The web base...
What are the shutdown commands for Linux systems?...
You may often see some HTML with data attributes. ...
Table of contents Overview Functionality and read...
Table of contents Proxy forwarding rules The firs...
MySQL password modification example detailed expl...
When I first came into contact with HTML, I alway...
1. Install the dependency packages first to avoid...
Table of contents Discover: Application of displa...
About JS, CSS CSS: Stylesheet at the top Avoid CS...
These introduced HTML tags do not necessarily ful...
Preface For security reasons, the root user of My...
This article shares the specific code of Vue.js f...