MySql installation and configuration on Mac

Source: Internet
Author: User

MySql installation and configuration on Mac

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.

sudo rm /usr/local/mysqlsudo rm -rf /usr/local/mysql*sudo rm -rf /Library/StartupItems/MySQLCOMsudo 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 section describes how to install and configure MySql on Mac. I hope it will be helpful to you. If you have any questions, please leave a message, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.