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
When I was printing for a client recently, he aske...
Effect: css: .s_type { border: none; border-radiu...
When I was asked this question, I was ignorant an...
concept MMM (Master-Master replication manager fo...
<br />Table is a tag that has been used by e...
In the past, I used to directly order by rand() t...
The following operation demonstrations are all ba...
Table of contents Overview Example 1) Freeze Obje...
3D coordinate concept When an element rotates, it...
Table of contents Preface What is VueUse Easy to ...
Table of contents Overview 1. How to animate a DO...
Table of contents 1 Create mount directories and ...
Problem to be solved Mainly for cross-level commu...
Using the Docker run command docker run -d -p 920...
Open Source Database Architecture Design Principl...