免费注册 查看新帖 |

Chinaunix

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

为何无法访问本地 mysql [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-09-10 23:40 |只看该作者 |倒序浏览
不知道为什么在本地执行的PHP脚本连接不了mysql,我检测如下:

mysqladmin -h `hostname` version variables
mysqladmin  Ver 8.41 Distrib 4.1.18, for unknown-linux-gnu on armeb
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Server version          4.1.18-log
Protocol version        10
Connection              MYNAS via TCP/IP
TCP port                3306
Uptime:                 20 min 12 sec

Threads: 2  Questions: 43  Slow queries: 0  Opens: 24  Flush tables: 1  Open tables: 4  Queries per second avg: 0.035
+---------------------------------+----------------------------+
| Variable_name                   | Value                      |
+---------------------------------+----------------------------+
| back_log                        | 50                         |
| basedir                         | /usr/                      |
| binlog_cache_size               | 32768                      |
| bulk_insert_buffer_size         | 8388608                    |
| character_set_client            | latin1                     |
| character_set_connection        | latin1                     |
| character_set_database          | latin1                     |
| character_set_results           | latin1                     |
| character_set_server            | latin1                     |
| character_set_system            | utf8                       |
| character_sets_dir              | /var/mysql/mysql/charsets/ |
| collation_connection            | latin1_swedish_ci          |
| collation_database              | latin1_swedish_ci          |
| collation_server                | latin1_swedish_ci          |
| concurrent_insert               | ON                         |
| connect_timeout                 | 5                          |
| datadir                         | /var/mysql/                |
| date_format                     | %Y-%m-%d                   |
| datetime_format                 | %Y-%m-%d %H:%i:%s          |
| default_week_format             | 0                          |
| delay_key_write                 | ON                         |
| delayed_insert_limit            | 100                        |
| delayed_insert_timeout          | 300                        |
| delayed_queue_size              | 1000                       |
| expire_logs_days                | 0                          |
| flush                           | OFF                        |
| flush_time                      | 0                          |
| ft_boolean_syntax               | + -><()~*:""&|             |
| ft_max_word_len                 | 84                         |
| ft_min_word_len                 | 4                          |
| ft_query_expansion_limit        | 20                         |
| ft_stopword_file                | (built-in)                 |
| group_concat_max_len            | 1024                       |
| have_archive                    | NO                         |
| have_bdb                        | NO                         |
| have_blackhole_engine           | NO                         |
| have_compress                   | YES                        |
| have_crypt                      | YES                        |
| have_csv                        | NO                         |
| have_example_engine             | NO                         |
| have_geometry                   | YES                        |
| have_innodb                     | NO                         |
| have_isam                       | NO                         |
| have_ndbcluster                 | NO                         |
| have_openssl                    | NO                         |
| have_query_cache                | NO                         |
| have_raid                       | NO                         |
| have_rtree_keys                 | YES                        |
| have_symlink                    | YES                        |
| init_connect                    |                            |
| init_file                       |                            |
| init_slave                      |                            |
| interactive_timeout             | 28800                      |
| join_buffer_size                | 131072                     |
| key_buffer_size                 | 16384                      |
| key_cache_age_threshold         | 300                        |
| key_cache_block_size            | 1024                       |
| key_cache_division_limit        | 100                        |
| language                        | /var/mysql/mysql/english/  |
| large_files_support             | ON                         |
| license                         | GPL                        |
| local_infile                    | ON                         |
| locked_in_memory                | OFF                        |
| log                             | ON                        |
| log_bin                         | ON                         |
| log_error                       |                            |
| log_slave_updates               | OFF                        |
| log_slow_queries                | OFF                        |
| log_update                      | OFF                        |
| log_warnings                    | 1                          |
| long_query_time                 | 10                         |
| low_priority_updates            | OFF                        |
| lower_case_file_system          | OFF                        |
| lower_case_table_names          | 0                          |
| max_allowed_packet              | 1047552                    |
| max_binlog_cache_size           | 4294967295                 |
| max_binlog_size                 | 1073741824                 |
| max_connect_errors              | 10                         |
| max_connections                 | 100                        |
| max_delayed_threads             | 20                         |
| max_error_count                 | 64                         |
| max_heap_table_size             | 16777216                   |
| max_insert_delayed_threads      | 20                         |
| max_join_size                   | 4294967295                 |
| max_length_for_sort_data        | 1024                       |
| max_relay_log_size              | 0                          |
| max_seeks_for_key               | 4294967295                 |
| max_sort_length                 | 1024                       |
| max_tmp_tables                  | 32                         |
| max_user_connections            | 100                          |
| max_write_lock_count            | 4294967295                 |
| myisam_data_pointer_size        | 4                          |
| myisam_max_extra_sort_file_size | 2147483648                 |
| myisam_max_sort_file_size       | 2147483647                 |
| myisam_recover_options          | OFF                        |
| myisam_repair_threads           | 1                          |
| myisam_sort_buffer_size         | 8388608                    |
| myisam_stats_method             | nulls_unequal              |
| net_buffer_length               | 2048                       |
| net_read_timeout                | 30                         |
| net_retry_count                 | 10                         |
| net_write_timeout               | 60                         |
| new                             | OFF                        |
| old_passwords                   | OFF                        |
| open_files_limit                | 1024                       |
| pid_file                        | /var/mysql/MYNAS.pid       |
| port                            | 3306                       |
| preload_buffer_size             | 32768                      |
| protocol_version                | 10                         |
| query_alloc_block_size          | 8192                       |
| query_prealloc_size             | 8192                       |
| range_alloc_block_size          | 2048                       |
| read_buffer_size                | 258048                     |
| read_only                       | OFF                        |
| read_rnd_buffer_size            | 258048                     |
| relay_log_purge                 | ON                         |
| relay_log_space_limit           | 0                          |
| rpl_recovery_rank               | 0                          |
| secure_auth                     | OFF                        |
| server_id                       | 1                          |
| skip_external_locking           | ON                         |
| skip_networking                 | OFF                        |
| skip_show_database              | OFF                        |
| slave_net_timeout               | 3600                       |
| slave_transaction_retries       | 0                          |
| slow_launch_time                | 2                          |
| socket                          | /tmp/mysql.sock            |
| sort_buffer_size                | 65528                      |
| sql_mode                        |                            |
| sql_notes                       | OFF                        |
| sql_warnings                    | OFF                        |
| storage_engine                  | MyISAM                     |
| sync_binlog                     | 0                          |
| sync_frm                        | ON                         |
| sync_replication                | 0                          |
| sync_replication_slave_id       | 0                          |
| sync_replication_timeout        | 0                          |
| system_time_zone                | UTC                        |
| table_cache                     | 4                          |
| table_type                      | MyISAM                     |
| thread_cache_size               | 0                          |
| thread_stack                    | 131072                     |
| time_format                     | %H:%i:%s                   |
| time_zone                       | SYSTEM                     |
| tmp_table_size                  | 33554432                   |
| tmpdir                          |                            |
| transaction_alloc_block_size    | 8192                       |
| transaction_prealloc_size       | 4096                       |
| tx_isolation                    | REPEATABLE-READ            |
| version                         | 4.1.18-log                 |
| version_comment                 | Source distribution        |
| version_compile_machine         | armeb                      |
| version_compile_os              | unknown-linux-gnu          |
| wait_timeout                    | 28800                      |
+---------------------------------+----------------------------+



mysqladmin --protocol=socket --socket=/tmp/mysql.sock version
mysqladmin  Ver 8.41 Distrib 4.1.18, for unknown-linux-gnu on armeb
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Server version          4.1.18-log
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /tmp/mysql.sock
Uptime:                 25 min 42 sec

Threads: 2  Questions: 46  Slow queries: 0  Opens: 24  Flush tables: 1  Open tables: 4  Queries per second avg: 0.030


netstat -ln | grep mysql
unix  2      [ ACC ]     STREAM     LISTENING     1204   /tmp/mysql.sock


mysql log纪录:
060910 22:25:47  mysqld started
/usr/libexec/mysqld: ready for connections.
Version: '4.1.18-log'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution


telnet MYNAS 3306
8
4.1.18-logRg0XID[},&?MCFvB$+M#d
Connection closed by foreign host.

ps ::
1410 root        636 S   /bin/sh /usr/bin/mysqld_safe --datadir=/var/mysql --pid-file=/var/mysql/MYNAS.pid
1485 mysql      2780 S   /usr/libexec/mysqld --basedir=/usr --datadir=/var/mysql --user=mysql --pid-file=/var/mysql/
1486 mysql      2780 S   /usr/libexec/mysqld --basedir=/usr --datadir=/var/mysql --user=mysql --pid-file=/var/mysql/
1487 mysql      2780 S   /usr/libexec/mysqld --basedir=/usr --datadir=/var/mysql --user=mysql --pid-file=/var/mysql/


php -v ::
PHP 4.4.3 (cgi-fcgi) (built: Aug  6 2006 02:11:47)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
    with eAccelerator v0.9.5-rc1, Copyright (c) 2004-2006 eAccelerator, by eAccelerator

PHP.ini ::
  1. [MySQL]
  2. mysql.allow_persistent = On
  3. mysql.max_persistent = -1
  4. mysql.max_links = -1
  5. mysql.default_port =
  6. mysql.default_socket =
  7. mysql.default_host =
  8. mysql.default_user =
  9. mysql.default_password =
  10. mysql.connect_timeout = 60
  11. mysql.trace_mode = Off
复制代码


PHP 4.4.3 Configure Command ::
  1. './configure' '--with-mysql' '--enable-force-redirect' '--enable-fastcgi' '--with-gd' '--with-png' '--with-zlib' '--with-jpeg' '--enable-exif' '--with-freetype-dir=/usr/local/include/freetype2/freetype' '--enable-ftp'  
复制代码


mysqladmin  --version
  1. mysqladmin  Ver 8.41 Distrib 4.1.18, for unknown-linux-gnu on armeb
复制代码

论坛徽章:
0
2 [报告]
发表于 2006-09-10 23:45 |只看该作者
晕,你提供的信息也太多了。
从 PHP 的 phpinfo 信息中,看看它使用的 mysql client 的版本。怀疑是版本不兼容。

论坛徽章:
0
3 [报告]
发表于 2006-09-11 09:23 |只看该作者
原帖由 rardge 于 2006-9-10 23:45 发表
晕,你提供的信息也太多了。
从 PHP 的 phpinfo 信息中,看看它使用的 mysql client 的版本。怀疑是版本不兼容。



版本不兼容?? 应该不会的,我之前也是用同一份PHP 4.4.3编译安装的。。。

一定要phpinfo的话,得回去再给你看看

PS,谢谢了!!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP