One, the configuration of the Apache server environment
Because the PHP Apache environment is self-bringing on Mac OS, there is no need to install another package, simply configure it. First open the Terminal input command:
One of the following lines is not commented out and the comments are removed.
# LoadModule Php5_module libexec/apache2/libphp5.so
After that, you can restart Apache with the following command:
sudo apachectl restart
Enter in the browser: http://localhost/, if present-- It works! Description The Apache PHP service environment was successfully configured.
II. installation and deployment of MySQL services
Download the DMG installation package for MySQL first. Click to download the latest version.
Open the DMG file, there are three installation items, which I installed in three, mysqlstartupitem.pkg installation, MySQL will start with the system boot, mysql.prefpane that you can see the MySQL option in System Preferences, There is also a MySQL installation.
This will make the installation successful, turn on MySQL in System Preferences, and turn the service on. After installation, the default username is root and the password is empty. For security, we need to set a password.
Open the terminal, if you enter the MySQL prompt without this command, then you need to configure the MySQL Bin directory environment variables. The directory address is:/usr/local/mysql/bin/, which is added to the path variable. Here I introduce another method, in Terminal input command:
Vim ~/.bash_profile
Then append the following on the last side
#mysql alias mysql= '/usr/local/mysql/bin/mysql ' alias mysqladmin= '/usr/local/mysql/bin/mysqladmin '
In this way, in the terminal to enter MySQL has this command, in fact, it is similar to our macro definition in C + +, the role of alias substitution.
Then we change the root password, the command is as follows:
Mysqladmin-uroot Password Admin
This will change the root password to admin.
III. Installation and Deployment PhpMyAdmin
To manage MySQL, if the command line is more troublesome, open source PhpMyAdmin use C/s mode, easy to manage. Then we put on a phpmyadmin. It was developed by PHP and I am currently the latest version: 4.7.3, corresponding to-
The downloaded decompression is placed in the/library/webserver/documents/directory, the complete directory is:/library/webserver/documents/phpmyadmin/, then the command line into this directory, enter the following command:
CP config.sample.inc.php config.inc.php vim config.inc.php
Follow the changes below:
$cfg [' blowfish_secret '] = '; Used for cookie encryption, random long string $cfg [' Servers '] [$i] [' host '] = ' 127.0.0.1 '; The MySQL daemon does IP binding
Then we can enter url:http://localhost/phpmyadmin/in the browser
User name: root password: admin
You can login to the MySQL admin interface at this point.
At this point, we are done, since then we can be very easy, very tall on the play MySQL database, is not very excited! ~~
Configure PhpMyAdmin on Mac