还是mysql的错!!请高手帮一下我(现在解决了)
我是FC4已经安了
Apache v2.0.53 for Linux
mysql-5.1.7-beta-linux-i686
php5.0.5
:
我有一点想不通的是
shell>mysql
Welcome to the MySQL monitor.Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 5.1.7-beta-max
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
同样我用shell>rpm -qa mysql
mysql-3.23.58-13
但在上面:
Your MySQL connection id is 4 to server version: 5.1.7-beta-max
Type
这个可以说明我忆经安装了mysql-5.1.7-beta了吗 ?
接下来
mysql>show variables like 'socket';
mysql>
+---------------+---------------------------+
| Variable_name | Value |
+---------------+---------------------------+
| socket | /var/lib/mysql/mysql.sock |
+---------------+---------------------------+
1 row in set (0.05 sec)
mysql> \q
我的mysql 是在/usr/local/mysql
# ls
bin docs INSTALL-BINARY (复件)README support-files
configureEXCEPTIONS-CLIENTlib scripts tests
COPYING include man share
data INSTALL-BINARY mysql-test sql-bench
shell> ./support-files/mysql.server start
Starting MySQLCouldn't find MySQL manager or server [失败]
现在想安phpMyAdmin就出了问题
进入http://localhost/phpMyAdmin/
Welcome to phpMyAdmin 2.6.4-pl4
Error:
MySQL said: Documentation
#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)
总结一下:
1:mysql.server启动失败
2:phpMyAdmin
请高手帮一下我 会不会是php设置问题呢 我写了一个php接mysql的index.php
<?php
// Connecting, selecting database
$link = mysql_connect('localhost', 'root', '')
or die('Could not connect: ' . mysql_error());
echo 'Connected successfully';
mysql_select_db('my_database') or die('Could not select database');
// Performing SQL query
$query = 'SELECT * FROM my_table';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
// Printing results in HTML
echo "<table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "\t<tr>\n";
foreach ($line as $col_value) {
echo "\t\t<td>$col_value</td>\n";
}
echo "\t</tr>\n";
}
echo "</table>\n";
// Free resultset
mysql_free_result($result);
// Closing connection
mysql_close($link);
?>
我想了一下在shell中mysql都能可以用 1!就是phpmyadmin不能接mysql,可通是php的设置出了问题!!
不能通过'/tmp/mysql.sock'连到服务器,
php标准配置正是用过'/tmp/mysql.sock',
但是一些mysql安装方法将mysql.sock放在/var/lib/mysql.sock或者其他的什么地方。
其实可以
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
还有在phpmyadmin里的config.inc.php的126行$cfg['Servers'][$i]['socket'] = '';
加上/tmp/mysql.sock为$cfg['Servers'][$i]['socket'] = '/tmp/mysql.sock';
现在http://localhost/phpMyAdmin/可以了!!
今天行了好多弯路!!!下线睡觉了!!! 1. 删除掉mysql-3.23.58-13 rpm -e --nodeps mysql
2. mysql-5.1.7-beta-linux-i686如果是rpm包直接安装的,/etc/init.d/mysqld stop或start
如果是tarball安装在/usr/local/mysql,/usr/local/mysql/bin/mysqld_safe &user=mysql
3. 和PHP5的配置以及phpMyAdmin没有关系 多谢涩兔子版主!!!又学到一招!!! 多谢涩兔子版主!!!又学到一招!!!
这个是我们文档工作做得不好,相信改版后的文档整理会达到及时跟进的 涩兔子版主,我的os是redhat9.0,采用最小化安装,我把mysql-3.23.57-pc-linux-i686.tar.gz, httpd-2.0.55.tar.gz, php-4.4.1.tar.gz都装好了,测试什么的也通过了,而且在linux里面用mysql -u root -p 可以进入mysql啊,但是我在客户端去访问的时候,提示我出错了:
warning:mysql_connect():access denied for user:'root@weiming' (using password:yes) in /usr/local/apache2/htdocs/log.php on line 8
error
我的mysql连接语句是:
$conn=mysql_connect("weiming","root","000000") or die("error");
您能帮我看下是什么问题? root 默认似乎不允许远程登录? 应该是MySQL的主机选择有关,weiming换成localhost试试看
给一个DSN数据抽象层的方法:
$dsn = 'mysql://username:password@localhost/databasename';
/* construct ADODB */
$this->db = NewADOConnection($dsn);
if (!$this->db) die('Connection failed');
$this->db->Execute("SET NAMES 'UTF8'");
页:
[1]