免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2164 | 回复: 4
打印 上一主题 下一主题

php与mysql无法连接是什么原因? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-03-24 15:55 |只看该作者 |倒序浏览
我的系统装好了,我装的是redhat-9.0默认安装了mysql数据库,安装完成后所有的服务都是正常的,可是用网页程序检测不到mysql大家看一下:
[root@localhost root]# /etc/rc.d/init.d/mysqld stop
停止 MySQL: [ 确定 ]
[root@localhost root]# /etc/rc.d/init.d/mysqld start
启动 MySQL: [ 确定 ]
[root@localhost root]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 3.23.54

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>; \s
--------------
mysql Ver 11.18 Distrib 3.23.54, for redhat-linux-gnu (i386)

Connection id: 1
Current database:
Current user: root@localhost
Current pager: stdout
Using outfile: ''
Server version: 3.23.54
Protocol version: 10
Connection: Localhost via UNIX socket
Client characterset: latin1
Server characterset: latin1
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 7 sec

Threads: 1 Questions: 2 Slow queries: 0 Opens: 6 Flush tables: 1 Open tables: 0 Queries per second avg: 0.286
--------------

mysql>; \q
Bye
[root@localhost root]#

请问是不是我的这个php.ini配置错了,请问这点应该怎么配置?
[MySQL]
; Allow or prevent persistent links.
mysql.allow_persistent = On

; Maximum number of persistent links. -1 means no limit.
mysql.max_persistent = -1

; Maximum number of links (persistent + non-persistent). -1 means no limit.
mysql.max_links = -1

; Default port number for mysql_connect(). If unset, mysql_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order). Win32 will only look
; at MYSQL_PORT.
mysql.default_port =

; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
mysql.default_socket =

; Default host for mysql_connect() (doesn't apply in safe mode).
mysql.default_host =

; Default user for mysql_connect() (doesn't apply in safe mode).
mysql.default_user =

; Default password for mysql_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to store passwords in this file.
; *Any* user with PHP access can run 'echo cfg_get_var("mysql.default_password"
; and reveal this password! And of course, any users with read access to this
; file will be able to reveal the password as well.
mysql.default_password =

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
2 [报告]
发表于 2004-03-24 15:56 |只看该作者

php与mysql无法连接是什么原因?

装上php-mysql那个包。

论坛徽章:
0
3 [报告]
发表于 2004-03-24 19:03 |只看该作者

php与mysql无法连接是什么原因?

Server localhost
Error

MySQL said:


#2002 - Can't connect to local MySQL server through socket 'mysql_connect' (2)

[Documentation]

十分感谢好好先生的指点,不过我安装phpmyadmin出现这种错误是什么原因?

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
4 [报告]
发表于 2004-03-24 19:08 |只看该作者

php与mysql无法连接是什么原因?

编辑你的config.inc.php加入你的mysql的主机名,用户名,密码。

论坛徽章:
0
5 [报告]
发表于 2004-03-25 11:44 |只看该作者

php与mysql无法连接是什么原因?

好好先生你好,我想请教你一个问题,我想为大家提供免费的php+mysql空间可是现在我无法控制用户的空间配额,请问如何才能限制空间呢?
http://bbs.cnlinux.org/viewtopic.php?t=4

这个帖子你看一下,希望你可以回复这个帖子,谢谢了!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP