Table of Contents
Configure PHP+MySql environment under Mac OS, osphp+mysql
Home Backend Development PHP Tutorial Configure PHP+MySql environment under Mac OS, osphp+mysql_PHP tutorial

Configure PHP+MySql environment under Mac OS, osphp+mysql_PHP tutorial

Jul 13, 2016 am 10:06 AM
apache mac mysql php

Configure PHP+MySql environment under Mac OS, osphp+mysql

Since mantis recently needs to be deployed for bug tracking, the process is recorded here.

Since the PHP apache environment comes with Mac OS, there is no need to install the installation package elsewhere, just a simple configuration.

First open the terminal and enter the command:

Copy code The code is as follows:

sudo vim /etc/apache2/httpd.conf

There is a line like this

Copy code The code is as follows:

#LoadModule php5_module libexec/apache2/libphp5.so

Remove the # sign in front.

Then open Sharing in System Preferences and check web sharing, as shown below

Restart apache, the command is as follows:

Copy code The code is as follows:

sudo apachectl restart

In this way, you can enter http://localhost/ in the browser, and if

appears

It works!

Description of successfully configuring the php environment

Let’s configure the MySql environment.

First download the dmg installation package of MySql. The download address is: http://dev.mysql.com/downloads/mysql/

Open the dmg file. There are three installation items in it. I installed all three here. After MySQLStartupItem.pkg is installed, mysql will start automatically when the system starts. MySQL.prefPane indicates that the mysql option can be seen in the system preferences. , and the other one is the mysql installation item.

In this way, the installation is successful. Open mysql in the system preferences and enable the service. After installation, the default username is root and the password is empty. For security, we set a password.

Open the terminal. If you enter mysql and you are prompted that there is no such command, you need to configure the environment variables of the mysql bin directory. The directory is, /usr/local/mysql/bin/, add it to the PATH variable. Here I introduce another method,

Enter

in the terminal

Copy code The code is as follows:

sudo vim /etc/bashrc

Then add

in it

Copy code The code is as follows:

#mysql
alias mysql='/usr/local/mysql/bin/mysql'
alias mysqladmin='/usr/local/mysql/bin/mysqladmin'

In this way, if you enter mysql in the terminal, you will have this command. In fact, it is somewhat similar to the macro definition in our C/C++, and the alias is used instead.

Then we change the root password, the command is as follows:

Copy code The code is as follows:

mysqladmin -uroot password 12345

This will change the root password to 12345.

To manage Mysql, if it is troublesome to use the command line, the open source phpMyAdmin adopts C/S mode for easy management. Then we install phpMyAdmin. It is developed by php, and the download address is: http://www.phpmyadmin.net/home_page/downloads.php

Put the downloaded unzipped file in the /Library/WebServer/Documents/ directory. The complete directory is: /Library/WebServer/Documents/phpmyadmin/, then enter this directory with the command line,

Enter the command:

Copy code The code is as follows:

cp config.sample.inc.php config.inc.php
vim config.inc.php

Make changes as follows:

Copy code The code is as follows:

$cfg['blowfish_secret'] = '';//For cookie encryption, any long string
$cfg['Servers'][$i]['host'] = '127.0.0.1';//MySQL daemon does IP binding

Now you can enter the URL in the browser: http://localhost/phpmyadmin/

Server name: root

The password is the password you set.

You can log in to the mysql management interface.

Okay, the above is all about configuring the PHP+MYSQL environment in MAC OS. I hope you guys like it.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/960717.htmlTechArticleConfiguring PHP+MySql environment under Mac OS, osphp+mysql Since mantis needs to be deployed for bug tracking recently, record it here its process. Since the PHP apache environment comes with Mac OS, it does not...
Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1666
14
PHP Tutorial
1273
29
C# Tutorial
1253
24
Steps to add and delete fields to MySQL tables Steps to add and delete fields to MySQL tables Apr 29, 2025 pm 04:15 PM

In MySQL, add fields using ALTERTABLEtable_nameADDCOLUMNnew_columnVARCHAR(255)AFTERexisting_column, delete fields using ALTERTABLEtable_nameDROPCOLUMNcolumn_to_drop. When adding fields, you need to specify a location to optimize query performance and data structure; before deleting fields, you need to confirm that the operation is irreversible; modifying table structure using online DDL, backup data, test environment, and low-load time periods is performance optimization and best practice.

What is the significance of the session_start() function? What is the significance of the session_start() function? May 03, 2025 am 12:18 AM

session_start()iscrucialinPHPformanagingusersessions.1)Itinitiatesanewsessionifnoneexists,2)resumesanexistingsession,and3)setsasessioncookieforcontinuityacrossrequests,enablingapplicationslikeuserauthenticationandpersonalizedcontent.

How to uninstall MySQL and clean residual files How to uninstall MySQL and clean residual files Apr 29, 2025 pm 04:03 PM

To safely and thoroughly uninstall MySQL and clean all residual files, follow the following steps: 1. Stop MySQL service; 2. Uninstall MySQL packages; 3. Clean configuration files and data directories; 4. Verify that the uninstallation is thorough.

An efficient way to batch insert data in MySQL An efficient way to batch insert data in MySQL Apr 29, 2025 pm 04:18 PM

Efficient methods for batch inserting data in MySQL include: 1. Using INSERTINTO...VALUES syntax, 2. Using LOADDATAINFILE command, 3. Using transaction processing, 4. Adjust batch size, 5. Disable indexing, 6. Using INSERTIGNORE or INSERT...ONDUPLICATEKEYUPDATE, these methods can significantly improve database operation efficiency.

How to use MySQL functions for data processing and calculation How to use MySQL functions for data processing and calculation Apr 29, 2025 pm 04:21 PM

MySQL functions can be used for data processing and calculation. 1. Basic usage includes string processing, date calculation and mathematical operations. 2. Advanced usage involves combining multiple functions to implement complex operations. 3. Performance optimization requires avoiding the use of functions in the WHERE clause and using GROUPBY and temporary tables.

How to configure the character set and collation rules of MySQL How to configure the character set and collation rules of MySQL Apr 29, 2025 pm 04:06 PM

Methods for configuring character sets and collations in MySQL include: 1. Setting the character sets and collations at the server level: SETNAMES'utf8'; SETCHARACTERSETutf8; SETCOLLATION_CONNECTION='utf8_general_ci'; 2. Create a database that uses specific character sets and collations: CREATEDATABASEexample_dbCHARACTERSETutf8COLLATEutf8_general_ci; 3. Specify character sets and collations when creating a table: CREATETABLEexample_table(idINT

Detailed explanation of the installation steps of MySQL on macOS system Detailed explanation of the installation steps of MySQL on macOS system Apr 29, 2025 pm 03:36 PM

Installing MySQL on macOS can be achieved through the following steps: 1. Install Homebrew, using the command /bin/bash-c"$(curl-fsSLhttps://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)". 2. Update Homebrew and use brewupdate. 3. Install MySQL and use brewinstallmysql. 4. Start MySQL service and use brewservicesstartmysql. After installation, you can use mysql-u

How to analyze the execution plan of MySQL query How to analyze the execution plan of MySQL query Apr 29, 2025 pm 04:12 PM

Use the EXPLAIN command to analyze the execution plan of MySQL queries. 1. The EXPLAIN command displays the execution plan of the query to help find performance bottlenecks. 2. The execution plan includes fields such as id, select_type, table, type, possible_keys, key, key_len, ref, rows and Extra. 3. According to the execution plan, you can optimize queries by adding indexes, avoiding full table scans, optimizing JOIN operations, and using overlay indexes.

See all articles