Installing MySQL under Apple and the problems encountered

Source: Internet
Author: User

Directly say the process:

1. Download MySQL 5.7 Latest version from MySQL website: There are two kinds of DMG's fool's bag, one is tar.gz's compression package. I downloaded the tar.gz zip package.

2. After the successful download, the first trial command sudo tar zxvf extracted to the current directory, because the default is in/user/fan/downloads, after decompression moved to/user/local

The directory has not been found because it has just come into contact with Apple. It turns out that Apple's table key automatically defaults to the first/users, not/user

In the current directory/users/fan/downloads use command: sudo mv +mysql folder/usr/local/mysql (mysql path does not exist, sudo mkdir /usr/local/mysql create first.) )

3. After moving past

    1. # Move the unpacked binary package to the installation directory
    2. sudo mv mysql-5.7.20-macos10.12-x86_64
      /usr/local/mysql
    3. # change the MySQL installation directory to the user and user group
    4. Cd/usr/local
    5. sudo chown-r root:wheel MySQL
    6. # perform some default initialization (create default configuration file, authorization table, etc.) by executing the mysql_install_db script in the scripts directory
    7. Cd/usr/local/mysql
    8. sudo bin/mysqld--initialize--user=mysql

5.7. 6 The above version cancels the scripts directory, the init command changed to sudo bin/mysqld--initialize--user=mysql
?? : When initializing, MySQL Initializes a password that cannot be forgotten or will not be logged in.

# Move the unpacked binary package to the installation directory sudo mv mysql-5.6.24-osx10.9-x86_64/usr/local/mysql# change the MySQL installation directory to the user and user group cd/usr/Localsudo Chown-R root:wheel mysql# perform some default initialization (create default configuration file, authorization table, etc.) by executing mysql_install_db script in scripts directory cd/usr/local/Mysqlsudo scripts/mysql_install_db--user=MySQL


Attention:?? There is a problem: When you start MySQL, the startup is not successful, because the MySQL startup program Support-files/mysql.server directory defaults to the/usr/local/mysql directory, not its subordinate directory. I was putting
mysql-5.6.24-osx10.9-x86_64 files in the file and files see all moved to the/usr/local/mysql/directory, after the successful start.


4. Installation complete, test start, restart and stop:
    1. Cd/usr/local/mysql
    2. # start
    3. sudo support-files/mysql.server start
    4. # restart
    5. sudo support-files/mysql.server restart
    6. # stop
    7. sudo support-files/mysql.server stop
    8. # Check MySQL run status
    9. sudo support-files/mysql.server status

5. After successful launch

Use the password you just initialized to get to MySQL.

Enter the/usr/local/mysql/bin directory

Mysql-uroot-p

Prompt to enter a password, copy the password just now. Successfully entered.

Then you can change the password: The command is as follows

Step 1:set PASSWORD = PASSWORD (' Your new PASSWORD ');

Step 2:alter USER ' root ' @ ' localhost ' PASSWORD EXPIRE never;

Step 3:flush privileges;

It must be like this three-part. I'll be fine later.

or according to the following two articles: (the first installment, the second is to set the MySQL password and login)

Source:

Http://www.widlabs.com/article/mac-os-x-install-mysql-with-tar-gz

http://blog.csdn.net/u013205165/article/details/52264311

Installing MySQL under Apple and the problems encountered

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.