mysql installed on your computer mac

       Installed on a mac computer mysql, relatively simple installation package is downloaded dmg, this approach is more common, can be obtained online search. You can also download the tar package to install, like that installed in linux, this is not easy to find information on installation, are relatively rare. In the currently logged on user mac installation is not complicated, but you can control the installation file, data file path, individuals feel slightly better this way. Basically the same step and linux, the following steps are mysql5.7.26 installation.

     1 download the installation package

https://dev.mysql.com/downloads/mysql/5.7.html#downloads

Here download macOS 10.14 (x86, 64-bit ), Compressed TAR Archive this tar package

  2 download directory, the downloaded to the tar package mv / usr / local unzipped

sudo mysql-5.7.26-macos10.14-x86_64.tar /usr/local/

tar -xvf mysql-5.7.26-macos10.14-x86_64.tar

3 Create a soft link mysql

ln -s mysql-5.7.26-macos10.14-x86_64/ mysql

4 Create a data storage directory, here is the data / mysql under the user's home directory, the user starts using the current mysql, no need to change the directory permissions

mkdir -p /data/mysql

5 initialize the database, xxxxxxxx for the current user name

./mysqld --initialize --datadir=/Users/xxxxxxxx/data/mysql --basedir=/usr/local/mysql --user=xxxxxxxx

After initialization, a temporary password will be displayed here database root user login to use for the first time, you need to write it down.

6 Create a my.cnf file in the / etc directory, add the base directory and data directory database here, other default settings

more my.cnf

[mysqld]

   basedir=/usr/local/mysql

   datadir=/Users/********/data/mysql

7 into the usr / local / mysql under / / support-files directory, start the database

./mysql.server start

8 into the / usr / local / mysql / temporary password bin, directory, database login, root password just remember

./mysql -uroot -p 'temporary password'  

Guess you like

Origin blog.csdn.net/lichx123/article/details/90373955