标签:
本文主要记录phpMyAdmin在Mac OS X上的配置和使用,避免朋友们走弯路,浪费不必要的时间。
1. 下载:
2. 在"设置"中打开" web share", 即可开启Mac自带的Apache, 也可以通过sudo apachectl restart, 重启Apache。
3. 源码放入 Apache的配置文件—httpd.cnf中DocumentRoot项指定的目录中,
4. 修改DocumentRoot下地phpmyadmin源码的访问权限。 chmod -R 755 phpMyAdmin-4.4.1/
5. 配置Apache的httpd.conf 如下:
<Directory "/Library/WebServer/Documents/phpMyAdmin-4.4.1">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Allow from all
</Directory>
6.在phpMyAdmin-4.4.1目录下,复制config.example.inc.php 保存为:config.inc.php ,并修改其部分内容:
$cfg[‘blowfish_secret‘] = ‘‘; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
/*
* Servers configuration
*/
$i = 0;
/*
* First server
*/
$i++;
/* Authentication type */
$cfg[‘Servers‘][$i][‘user‘] = ‘root‘; //mysql username here
$cfg[‘Servers‘][$i][‘password‘] = ‘xxxx‘; //mysql password here
$cfg[‘Servers‘][$i][‘auth_type‘] = ‘config‘;
/* Server parameters */
$cfg[‘Servers‘][$i][‘host‘] = ‘localhost‘;
$cfg[‘Servers‘][$i][‘connect_type‘] = ‘tcp‘;
$cfg[‘Servers‘][$i][‘compress‘] = false;
$cfg[‘Servers‘][$i][‘AllowNoPassword‘] = false;
如果你忘记了mysql 密码,可以通过如下方法修改:
1. sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables -u root &
2. "sudo /Library/StartupItems/MySQLCOM/MySQLCOM start” 可跳过,原因未知
3. Then you should be able to log into MySQL as root: "/usr/local/mysql/bin/mysql -u root"
4. 修改密码: "UPDATE mysql.user SET Password = PASSWORD( ‘new-password‘ ) WHERE User = ‘root‘;"
"FLUSH PRIVILEGES;"
"quit;"
5. 尝试用新密码登陆: "/usr/local/mysql/bin/mysql -u root -p"
7. 即将大功告成!此时,如果你通过sudo apachectl restart, 重启Apache,并通过网络地址访问,可能还是会提示你出错: mysql said: cannot connect: invalid settings.
这可能是应为phpmyadmin 默认使用/var/mysql/mysql.sock来连接mysqld.
8. 为phpmyadmin 的默认sock目录创建一个连接到真实sock的链接。
8.1 sudo mkdir /var/mysql/
8.2 sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
9.最后fuck , 一个为程序员准备的产品,竟然不提示详细的stack, 连错误提示都他妈草草了事,浪费劳资多少时间。
参考:
1. http://stackoverflow.com/questions/13357561/error-1045-cannot-log-in-to-mysql-server-phpmyadmin
2. http://coolestguidesontheplanet.com/installing-phpmyadmin-on-mac-osx-10-7-lion/
phpMyAdmin在Mac OS X上的配置和使用
标签:
原文地址:http://www.cnblogs.com/ToDoToTry/p/4401978.html