macos+apache+php+phpmyadmin 的整合过程梳理
启动Apache
有两种方法:
如此在浏览器中输入“http://localhost”,就可以看到一个内容为“It works!”的页面,其位于“/Library(资源库)/WebServer/Documents/”下,这就是Apache的默认根目录。
运行PHP
安装MySQL
Mac OS X没有内置MySQL,所以需要自己手动安装,目前MySQL的最稳定版本是5.5。MySQL提供了Mac OS X下的安装说明。
注意:Mac OS X的升级或其他原因可能会导致MySQL启动或开机自动运行时,在MySQL操作面板上会提示“Warning:The /usr/local/mysql/data directory is not owned by the 'mysql' or '_mysql'
”,这应该是某种情况下导致/usr/local/mysql/data
的宿主发生了改变,只需要运行“sudo chown -R mysql /usr/local/mysql/data
”即可。
另外,使用PHP连接MySQL可能会报错“Can’t connect to local MySQL server through socket ‘/var/mysql/mysql.sock’”,或使用localhost无法连接MySQL而需要127.0.0.1,原因是连接时php默认去找/var/mysql/mysql.sock
了,但MAC版的MYSQL改动了文件位置,放在/tmp下了。处理办法是按如下修改php.ini:
<code>mysql.default_socket = /tmp/mysql.sock<br /></code>
使用phpMyAdmin
phpMyAdmin是用PHP开发的管理MySQL的程序,非常的流行和实用。能够使用phpMyAdmin管理MySQL是检验前面几步效果的非常有效方式。这个主要是在最近研究的phpcms中才开始应用的,步骤如下:
<code><br /><br /><span><span <strong>关于错误处理:</strong></span><br /></span></code>
解决
<code></code>
将config.sample.inc.php复制成config.inc.php
<code></code>
<code></code>
<code></code>
<code></code>
<code></code>
--------------------------------------------------<code></code>
或者<code></code>修改 php.ini : mysql.default_socket = /tmp/mysql.sock
#1045 无法登录 MySQL 服务器。Access denied for user ‘root’@'localhost’ (using password: YES)
问题原因:这有可能是由于前面设置mysql密码没有成功,所以导致了我们使用设置的mysql root密码无法登陆服务器。
解决方法:这时可以尝试使用mysql 默认的root账号的空密码登陆数据库。
如果使用空密码登陆时又出现: 的错误。则要修改/phpmyadmin/config.inc.php 文件,找到下面两行
$cfg['Servers'][$i]['nopassword'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;
将两个false改为true,同时设置 $cfg['Servers'][$i]['password'] = '';通过这样设置配置文件后phpmyadmin 就会允许以空密码方式登录mysql数据库了。
若重新以空密码方式登录phpmyadmin有时仍无法登陆,请清除cookie或关闭原来的phpmyadmin 登录窗口,重新使用空密码登录。
若这时候仍然显示空密码登陆被禁止,试试随便输入几个字符当作密码看是否能够登陆成功。
登陆mysql服务器之后尽快将mysql密码在phpmyadmin中修改过来。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The combination of Vue.js and ASP.NET provides tips and suggestions for performance optimization and expansion of web applications. With the rapid development of web applications, performance optimization has become an indispensable and important task for developers. As a popular front-end framework, Vue.js combined with ASP.NET can help us achieve better performance optimization and expansion. This article will introduce some tips and suggestions, and provide some code examples. 1. Reduce HTTP requests The number of HTTP requests directly affects the loading speed of web applications. pass

Translator | Reviewed by Chen Jun | Chonglou In the 1990s, when people mentioned software programming, it usually meant choosing an editor, checking the code into the CVS or SVN code base, and then compiling the code into an executable file. Corresponding integrated development environments (IDEs) such as Eclipse and Visual Studio can integrate programming, development, documentation, construction, testing, deployment and other steps into a complete software development life cycle (SDLC), thus improving the work of developers. efficiency. In recent years, popular cloud computing and DevSecOps automation tools have improved developers' comprehensive capabilities, making it easier for more enterprises to develop, deploy and maintain software applications. Today, generative AI is the next generation development

How to correctly use and optimize the MySQL connection pool in ASP.NET programs? Introduction: MySQL is a widely used database management system that features high performance, reliability, and ease of use. In ASP.NET development, using MySQL database for data storage is a common requirement. In order to improve the efficiency and performance of database connections, we need to correctly use and optimize the MySQL connection pool. This article will introduce how to correctly use and optimize the MySQL connection pool in ASP.NET programs.

How to reconnect to MySQL in ASP.NET program? In ASP.NET development, it is very common to use the MySQL database. However, due to network or database server reasons, the database connection may sometimes be interrupted or time out. In this case, in order to ensure the stability and reliability of the program, we need to re-establish the connection after the connection is disconnected. This article will introduce how to reconnect MySQL connections in ASP.NET programs. To reference the necessary namespaces first, reference them at the head of the code file

The combination of Vue.js and ASP.NET enables the development and deployment of enterprise-level applications. In today's rapidly developing Internet technology field, the development and deployment of enterprise-level applications has become more and more important. Vue.js and ASP.NET are two technologies widely used in front-end and back-end development. Combining them can bring many advantages to the development and deployment of enterprise-level applications. This article will introduce how to use Vue.js and ASP.NET to develop and deploy enterprise-level applications through code examples. First, we need to install

How to correctly configure and use MySQL connection pool in ASP.NET program? With the development of the Internet and the increase in data volume, the demand for database access and connections is also increasing. In order to improve the performance and stability of the database, connection pooling has become an essential technology. This article mainly introduces how to correctly configure and use the MySQL connection pool in ASP.NET programs to improve the efficiency and response speed of the database. 1. The concept and function of connection pooling. Connection pooling is a technology that reuses database connections. At the beginning of the program,

How to correctly use and optimize the transaction performance of MySQL connection pool in ASP.NET programs? In ASP.NET programs, database transactions are a very important part. Transactions ensure the consistency and integrity of the database while also providing better performance. When using a MySQL database, it is essential to use connection pools to manage connection resources and optimize performance. First, let us briefly understand the concept of MySQL connection pool. The connection pool is a buffer pool of a group of connections. By pre-initializing a certain number of

The built-in objects in ASP.NET include "Request", "Response", "Session", "Server", "Application", "HttpContext", "Cache", "Trace", "Cookie" and "Server.MapPath": 1. Request, indicating the HTTP request issued by the client; 2. Response: indicating the HTTP response returned by the web server to the client, etc.
