Download the dmgformat installation file from the MySQL website http://mysql.com/downloads/mysql. 64-bit (x86, 64-bit) is recommended ).
Open the installation package. The first file with the extension of PKG is the installation file. MySQL does not need to be compiled and installed, just run PKG to install it. Install Mac OS X PKG of MySQL to/usr/local/MySQL-version, and generate a symbolic connection,/usr/local/MySQL, pointing to a new location. If the/usr/local/MySQL directory exists, first change it to/usr/local/MySQL. Bak. After installation, the installer automatically runs mysql_install_db to create an authorization table in the MySQL database.
After the installation is complete, double-click the mysql. prefpane file to add a MySQL Management Panel to the system settings. You can enable and disable MySql in system preference settings.
If mysql. prefpane is installed, a new "MySQL" item is displayed when you enable system preference settings. Start and Stop the MySQL service. At the same time, we can see that there is a single "automatically start MySQL server on startup" below, that is, whether to start the MySQL service with the system boot. If you select it, the following mysqlstartupitem. PKG does not need to be installed.
What is the file mysqlstartupitem. PKG? It provides the function of starting MySQL with the MAC system. How can I cancel starting with the system? Just now, just remove random start.
Read the readme.txt file carefully and you will find that you can create two alias instances for MySQL and mysqladmin. In this way, you do not have to enter the full path to execute MySQL and mysqladmin.
Run in the terminal:
12 |
alias
mysql=
/usr/local/mysql/bin/mysql alias
mysqladmin=
/usr/local/mysql/bin/mysqladmin |
The newly installed MySQL has no password. You can use the following command to create a password for the root user. For example, we set the initial password to 123456 for the root user of MySQL.
1 |
/usr/local/mysql/bin/mysqladmin
-u root password 123456
|
In addition to enabling and disabling MySQL on the control panel, you can also use the terminal command line to control startup, stop, and restart:
sudo /Library/StartupItems/MySQLCOM/MySQLCOM [start|stop|restart]
OK. installation is complete.