- 论坛徽章:
- 3
|
这个是连接mysql的php页面代码
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
$mysql_host = 'localhost';
$mysql_user = 'root';
$mysql_password = '11111';
$mysql_database = 'tsinghua';
if (!mysql_connect($mysql_host, $mysql_user, $mysql_password)) {
die(mysql_error());
}
if (!mysql_select_db($mysql_database)) {
die(mysql_error());
}
?>
在本地能用root登录mysql,但是无法连接mysql,在web页面上报这样的错误:Access denied for user 'root'@'localhost' (using password: NO),那个代码明明写着mysql的密码呢,为何还是登不上去啊。。。要疯了 |
|