Home  >  Article  >  Database  >  Detailed tutorial on compiling and installing MySQL 5.7.17 from source code on Mac system

Detailed tutorial on compiling and installing MySQL 5.7.17 from source code on Mac system

黄舟
黄舟Original
2017-03-20 13:38:191928browse

This article mainly introduces the source code compilation under Mac systemInstallationMySQL The detailed tutorial of 5.7.17 is very good and has reference value. Friends in need can refer to it

1. Download and extract to: /Users/xiechunping/Softwares/mysql-5.7.17

2. Enter mysql-5.7.17 and execute cmake

cd ../mysql-5.7.17
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql 
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock 
-DDEFAULT_CHARSET=utf8 
-DDEFAULT_COLLATION=utf8_general_ci 
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_ARCHIVE_STORAGE_ENGINE=1 
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 
-DWITH_PARTITION_STORAGE_ENGINE=1 
-DENABLED_LOCAL_INFILE=1 
-DMYSQL_USER=_mysql 
-DMYSQL_TCP_PORT=3306 
-DMYSQL_DATADIR=/usr/local/mysql/db_data 
-DDOWNLOAD_BOOST=1 
-DWITH_BOOST=/Users/xiechunping/Softwares/mysql-5.7.17/boost

3. Configure data directory permissions

chown -R _mysql:_mysql /usr/local/mysql/db_data

4. Compile and install

make&&make install

5. Install the database and start it

cd /usr/local/mysql
bin/mysql_install_db --user=mysql --datadir=/usr/local/mysql/db_data
support-files/mysql.server start

6. Modify the database root user password (first time entry password Empty)

Modify: /usr/local/mysql/support-files/mysql.server line 280

Add the startup option for mysql: --user=mysql --skip- grant-tables --skip-networking

Execute:

support-files/mysql.server stop && support-files/mysql.server stop
bin/mysql -u root mysql
mysql>UPDATE user SET authentication_string=PASSWORD('mysql54321') where USER='root';
mysql>FLUSH PRIVILEGES;
mysql>quit;
support-files/mysql.server stop

Restore the /usr/local/mysql/support-files/mysql.server file

support-files/mysql.server start
bin/mysql -uroot -p
Enter password: <输入新设的密码mysql54321>
mysql>SET PASSWORD = PASSWORD(&#39;mysql54321&#39;);
mysql>ALTER USER &#39;root&#39;@&#39;localhost&#39; PASSWORD EXPIRE NEVER;
mysql>flush privileges;
mysql>quit;

The above is the detailed content of Detailed tutorial on compiling and installing MySQL 5.7.17 from source code on Mac system. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn