Home >Backend Development >PHP Tutorial >Overview of the integration process of macos+apache+php+phpmyadmin_PHP tutorial
There are two methods:
In this way, enter "http://localhost" in the browser, you can see a page with the content "It works!", which is located under "/Library (resource library)/WebServer/Documents/", this This is the default root directory of Apache.
Mac OS X does not have built-in MySQL, so you need to install it manually. Currently, the most stable version of MySQL is 5.5. MySQL provides installation instructions for Mac OS X.
Note: Upgrading of Mac OS Changes have occurred, just run "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
In addition, when using PHP to connect to MySQL, the error "Can't connect to local MySQL server through socket '/var/mysql/mysql.sock'" may be reported, or using localhost cannot connect to MySQL and requires 127.0.0.1, because the connection PHP looked for
/var/mysql/mysql.sock
<code>mysql.default_socket = /tmp/mysql.sock<br /></code>
. The steps are as follows:
Solution<code><br /><br /><span><span <strong>关于错误处理:</strong></span><br /></span></code>
Copy config.sample.inc.php to config.inc.php
<code></code>
This error occurs, indicating that there is no connection to the database. Modify the config.inc.php file,
<code></code>Set $cfg['Servers'][$i]['host'] = 'localhost';
<code></code>Change to $cfg['Servers'][$i]['host'] = '127.0.0.1';
<code></code>
<code></code>-------------------------------------------------- ---
<code></code>
<code></code>or
modify php.ini: mysql.default_socket = /tmp/mysql.sock<code></code>
#1045 Unable to log in to MySQL server . Access denied for user 'root'@'localhost' (using password: YES)
Cause of the problem: This may be due to the failure to set the mysql password previously, which resulted in us being unable to log in to the server using the set mysql root password.
Solution: At this time, you can try to log in to the database using the empty password of the mysql default root account.
error. Then you need to modify the /phpmyadmin/config.inc.php file and find the following two lines
$cfg['Servers'][$i]['nopassword'] = false;$cfg['Servers'][$i]['AllowNoPassword'] = false;
Change the two false to true and set
$cfg['Servers'][$i]['password'] = ''; Set the configuration file like this After that, phpmyadmin will allow logging in to the mysql database with an empty password. If you still cannot log in to phpmyadmin with an empty password again, please clear the cookies or close the original phpmyadmin login window and log in again with an empty password.
If it still shows that login with an empty password is prohibited, try entering a few characters as a password to see if you can log in successfully.
After logging in to the mysql server, change the mysql password in phpmyadmin as soon as possible.
http://www.bkjia.com/PHPjc/750100.html