徐小峰 发表于 2016-2-3 22:22:26

phpMyAdmin在Mac OS X上的配置和使用

phpMyAdmin在Mac OS X上的配置和使用
主题
1.网上下载phpMyAdmin
2.在phpMyAdmin目录下,复制config.example.inc.php 保存为:config.inc.php ,并修改其部分内容:
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* phpMyAdmin sample configuration, you can use it as base for
* manual configuration. For easier setup you can use setup/
*
* All directives are explained in documentation in the doc/ folder
* or at <http://docs.phpmyadmin.net/>.
*
* @package PhpMyAdmin
*/

/*
* This is needed for cookie based authentication to encrypt password in
* cookie
*/
$cfg['blowfish_secret'] = 'ewqewqewqe'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

/*
* Servers configuration
*/
$i = 0;

/*
* First server
*/
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['DefaultLang'] = 'zh';

/*
* Directories for saving/loading files from server
*/
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
3.如果你忘记了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"

4. 即将大功告成!此时,如果你通过sudo apachectl restart, 重启Apache,并通过网络地址访问,可能还是会提示你出错: mysql said: cannot connect: invalid settings. \
   
这可能是应为phpmyadmin 默认使用/var/mysql/mysql.sock来连接mysqld.


5. 为phpmyadmin 的默认sock目录创建一个连接到真实sock的链接。
   5.1sudo mkdir /var/mysql/
   5.2sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock

页: [1]
查看完整版本: phpMyAdmin在Mac OS X上的配置和使用