错误#1045 - Access denied for user 'pmausr'@'localhost' (using password: YES)
闲来没事,就将自己的老电脑架设成支持PHP MYSQL的网站服务器。
其中Apache、php、MySql、phpMyAdmin正常安装,没有出现任何错误。
但到最后的登录phpMyAdmin却提示:

引用
错误#1045 - Access denied for user 'pmausr'@'localhost' (using password: YES)


先把安装方法记录下吧,留给有需要的朋友。

1.准备好电脑.系统,网络等.
此时网络可以不联入,(此时网络对安装调试过程无影响,但是要有IE浏览器.)
2.下载软件
apache.
官方网站:  http://httpd.apache.org
2.0.59下载地址:  http://www.signal42.com/mirrors/apache/httpd/binaries/win32/apache_2.0.59-win32-x86-no_ssl.msi
php
官方网站:  http://www.php.net
4.4.6下载地址:  http://cn2.php.net/distributions/php-4.4.6-Win32.zip
mysql
官方网站: http://www.mysql.org
4.1.22下载地址:  http://mysql.new21.com/Downloads/MySQL-4.1/mysql-4.1.22-win32.zip
3.安装软件.
1.安装apache.
  1.直接双击安装程序,next-->"I accept the terms in the license agreement"-->...."Server Information"(服务器信息);
  2."Network Domain"处填写***.**(例如lidande.cn);"Server Domain"处填写www.***.**(例如www.lidande.cn);  Administrator's  Email Addess"处填写管理员信箱.(用于接受apache错误信息.).
  3.在"Setup Type"界面中选择"Custom"-->next-->选择路径,点击change,选择需要安装到的目录.-->Install-->(如果启用了
windows防火墙则点击弹出的"安全警告"界面中的"解除阻止")-->Finish.
  4.测试apache服务器是否正常:打开IE浏览器.在地址栏中输入:"127.0.0.1"或者"localhost"(不包含"").如果正常显示了
apache的默认页面.那么就表示apache服务器已经正常工作了.
  5.打开"安装目录"-->"htdoc目录"就可以看到apache的网页目录了.将目录中所有文件删除,换成自己的网页文件(必须包含一个
index.htm文件),然后访问"127.0.0.1"就可以看到自己的页面了.
2.安装php.
  1.将下载到的压缩包解压,将"php-4.4.6-win32"(可能有两层.选择最里面的一层.就是包含php.exe的那一层.)改名为php,然后移动
到apache安装的盘并与apache处于同一层次.(建议统一放在根目录.).
  2.将php4ts.dll移动到"系统分区\windows\system32"中.
  3.用记事本打开"apache安装目录\conf\httpd.conf"文件,在最后面添加如下代码:

#Load the PHP module and set up the .php extension
LoadModule php4_module e:/php/sapi/php4apache2.dll
AddType application/x-httpd-php .php



4.仍是这个文件,按下ctrl+f,搜索"DirectoryIndex",在index.html.var后面加一个空格,然后再输入"index.php".然后保存文件.
  5.重启apache服务器.单击任务栏apache服务器图标-->apache2-->Restart . 无提示就说明设置正确了.(可能有些名称与你的
不一样,但是知道在哪里就好了.)
  6.打开"php安装目录\php.ini-dist"复制粘贴一份.修改文件名为"php.ini".
  7.在apache配置文件httpd.conf的最后添加: PHPINIDir e:/php/php.ini (自行替换目录.)[在配置文件最后是有一行空格的.
到底是不是真的有关系我也不清楚.不过还是留着的好..免得出什么稀奇古怪的问题.]
  8.打开php.ini文件.搜索"doc_root"(网页根目录), 修改为: doc_root = "e:/apache2/htdocs"  (自行替换目录).
  搜索"extension_dir", 修改为: extension_dir = "e:/php/extensions"  (自行替换目录).
  9.在php安装目录下新建"include"子目录.找到"include_path"(; Windows: "\path1;\path2"下面那行.)修改为:

; Windows: "\path1;\path2"
include_path = ".:e:/php/include"


10.搜索";session.save_path = /tmp",修改为:"session.save_path = e:/php/sessions",并在php安装目录中建立"sessions"

目录.同样的方法,设置"upload_tmp_dir = e:/php/tmp",并建立目录.
  11.重启apache服务器.
  12.测试php是否成功安装.
  新建文本文档,打开.输入以下内容:

<?php
phpinfo();
?>


保存为test.php文件.放到网页目录下.用IE浏览:http://127.0.0.1/test.php.如果正常显示了一个页面(其实是系统信息),就表示php安装成功了.


3.安装mysql
  1.解压.运行安装包.next-->"Setup Type"选择Custom,next-->"Install to"-change-选择安装目录(建议安装在apache与php相同的
目录层次中).然后next到"MySQL.com Sign-Up",选择"skip Sign-Up"(跳过注册.),next,选中"Configure the MySQL Server now"(现在配置
MySQL服务器).Finish(完成).
  2.配置向导:next-->选择Detailed Configuration-->next-->选择Server Machine-->next-->选择Multifuntion Database-->next
-->路径不用修改或者修改盘符为apache服务器所在的盘符.-->next-->选择OLTP-->next--选中Enable TCP/IP Networking(启用TCP/IP网络
连接),修改或不修改端口(无所谓,只要你能记住.)-->next-->选择"Best Support For Multilingualism"(UTF-8编码--通用编码,推荐选择)
-->选中"Install as Windows Service"(安装为windows服务)和"Launch the MySQL Server automatically"(自动启动Mysql服务器)-->
next-->选中"Modify Security Settings"(更改安全设置),并在"New root password"(新管理员密码)和"Confirm"(重复,就是再填写一次
密码.)处填写好新的密码(记住了..忘记了就要完全清除mysql再重装.).确认没有选中"Enable root access from remote machines"(允许
远程主机通过root权限访问)-->next-->Execute(执行)-->Finish.重启系统.
4.安装phpmyadmin
在phpmyadmin目录下有一个"config.sample.inc.php"文件.修改文件名为"config.inc.php".然后用记事本打开.做如下修改:
1.
$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
$cfg['blowfish_secret'] = 'duyao'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */


duyao为任意字符.必须修改.

$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['host'] = 'localhost:6033';


6033为你安装mysql时设置的端口号.未修改则为:3066
做如上修改后.打开:http://127.0.0.1/phpmyadmin 看看效果吧~~


好了,可是遇到错误应该怎么办呢?

曾尝试在 MySQL的命令行中更新密码、phpmyadmin的登陆页面中,先选一下繁体字,然后再选简体中文,然后再登陆,都不成功。


以下是config.inc.php文件的代码
引用
/* $Id: config.sample.inc.php 9675 2006-11-03 09:06:06Z nijel $ */
// vim: 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 scripts/setup.php
*
* All directives are explained in Documentation.html and on phpMyAdmin
* wiki .
*/
/*
* This is needed for cookie based authentication to encrypt password in
* cookie
*/
$cfg['blowfish_secret'] = 'dyaolaile'; /* 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]['compress'] = false;
/* Select mysqli if your server has it */
$cfg['Servers'][$i]['extension'] = 'mysql';
/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'pmausr';
$cfg['Servers'][$i]['controlpass'] = 'pmapass';
/* Advanced phpMyAdmin features */
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
$cfg['Servers'][$i]['relation'] = 'pma_relation';
$cfg['Servers'][$i]['table_info'] = 'pma_table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma_column_info';
$cfg['Servers'][$i]['history'] = 'pma_history';
/*
* End of servers configuration
*/
/*
* Directories for saving/loading files from server
*/
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
?>



把config.inc.php文件的代码发给了几个朋友,竟然都不知道怎么回事,网上的方法也试了,还是不成,但在自己的努力下最后终于成功了。

具体方法如下:

引用
在config.inc.php 文件中

搜索「$cfg['Servers'][$i]['auth_type'] = 'cookie';」,改成「$cfg['Servers'][$i]['auth_type'] = 'http';」

搜索「$cfg['Servers'][$i]['controluser'] = 'pmausr';」,改成「$cfg['Servers'][$i]['controluser'] = 'root';」

搜索「$cfg['Servers'][$i]['controlpass'] = 'pmapass';」,改成「$cfg['Servers'][$i]['controlpass'] = 'MYSQL的密码;」

Category: 电脑网络 , 2007/10/05 , 18:10 , 0 Comments , 3948 Read
发表评论
昵称 [注册]
密码 游客无需密码
网址
电邮
打开HTML 打开UBB 打开表情 隐藏 记住我